We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6588fdb commit 4dd1995Copy full SHA for 4dd1995
drivers/input/misc/ims-pcu.c
@@ -845,6 +845,12 @@ static int ims_pcu_flash_firmware(struct ims_pcu *pcu,
845
addr = be32_to_cpu(rec->addr) / 2;
846
len = be16_to_cpu(rec->len);
847
848
+ if (len > sizeof(pcu->cmd_buf) - 1 - sizeof(*fragment)) {
849
+ dev_err(pcu->dev,
850
+ "Invalid record length in firmware: %d\n", len);
851
+ return -EINVAL;
852
+ }
853
+
854
fragment = (void *)&pcu->cmd_buf[1];
855
put_unaligned_le32(addr, &fragment->addr);
856
fragment->len = len;
0 commit comments