All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tc358743: limit msg.len to CEC_MAX_MSG_SIZE
@ 2022-08-24  7:00 Hans Verkuil
  0 siblings, 0 replies; only message in thread
From: Hans Verkuil @ 2022-08-24  7:00 UTC (permalink / raw)
  To: linux-media

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>
---
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index e18b8947ad7e..804b8ee8e4ab 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -964,6 +964,8 @@ static void tc358743_cec_handler(struct v4l2_subdev *sd, u16 intstatus,
 
 		v = i2c_rd32(sd, CECRCTR);
 		msg.len = v & 0x1f;
+		if (msg.len > CEC_MAX_MSG_SIZE)
+			msg.len = CEC_MAX_MSG_SIZE;
 		for (i = 0; i < msg.len; i++) {
 			v = i2c_rd32(sd, CECRBUF1 + i * 4);
 			msg.msg[i] = v & 0xff;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-24  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24  7:00 [PATCH] tc358743: limit msg.len to CEC_MAX_MSG_SIZE Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.