diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2022-08-24 09:02:42 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-09-24 08:44:55 +0200 |
commit | 93f65ce036863893c164ca410938e0968964b26c (patch) | |
tree | 39bbc18c41d9cff20903908e93eda3c404399245 | |
parent | media: rkisp1: Zero v4l2_subdev_format fields in when validating links (diff) | |
download | linux-93f65ce036863893c164ca410938e0968964b26c.tar.xz linux-93f65ce036863893c164ca410938e0968964b26c.zip |
media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE
I expect that the hardware will have limited this to 16, but just in
case it hasn't, check for this corner case.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r-- | drivers/media/cec/platform/s5p/s5p_cec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/cec/platform/s5p/s5p_cec.c b/drivers/media/cec/platform/s5p/s5p_cec.c index ce9a9d922f11..0a30e7acdc10 100644 --- a/drivers/media/cec/platform/s5p/s5p_cec.c +++ b/drivers/media/cec/platform/s5p/s5p_cec.c @@ -115,6 +115,8 @@ static irqreturn_t s5p_cec_irq_handler(int irq, void *priv) dev_dbg(cec->dev, "Buffer overrun (worker did not process previous message)\n"); cec->rx = STATE_BUSY; cec->msg.len = status >> 24; + if (cec->msg.len > CEC_MAX_MSG_SIZE) + cec->msg.len = CEC_MAX_MSG_SIZE; cec->msg.rx_status = CEC_RX_STATUS_OK; s5p_cec_get_rx_buf(cec, cec->msg.len, cec->msg.msg); |