Commit bcd2ebb7 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] drxk: Avoid OOPSes if firmware is corrupted

Don't read paste the buffer, if the firmware is corrupted.
Instead, print an error message.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e076c92e
...@@ -1388,6 +1388,12 @@ static int DownloadMicrocode(struct drxk_state *state, ...@@ -1388,6 +1388,12 @@ static int DownloadMicrocode(struct drxk_state *state,
BlockCRC = (pSrc[0] << 8) | pSrc[1]; BlockCRC = (pSrc[0] << 8) | pSrc[1];
pSrc += sizeof(u16); pSrc += sizeof(u16);
offset += sizeof(u16); offset += sizeof(u16);
if (offset + BlockSize > Length) {
printk(KERN_ERR "drxk: Firmware is corrupted.\n");
return -EINVAL;
}
status = write_block(state, Address, BlockSize, pSrc); status = write_block(state, Address, BlockSize, pSrc);
if (status < 0) if (status < 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment