Skip to content

Commit

Permalink
media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE
Browse files Browse the repository at this point in the history
[ Upstream commit 2dc73b4 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Hans Verkuil authored and gregkh committed Nov 10, 2022
1 parent cbfa269 commit 73dfb64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/media/cec/platform/cros-ec/cros-ec-cec.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ static void handle_cec_message(struct cros_ec_cec *cros_ec_cec)
uint8_t *cec_message = cros_ec->event_data.data.cec_message;
unsigned int len = cros_ec->event_size;

if (len > CEC_MAX_MSG_SIZE)
len = CEC_MAX_MSG_SIZE;
cros_ec_cec->rx_msg.len = len;
memcpy(cros_ec_cec->rx_msg.msg, cec_message, len);

Expand Down

0 comments on commit 73dfb64

Please sign in to comment.