Commit 3028fb90 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

media: tc358743: 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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 05c480f4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;