V4L/DVB (7958): fix unaligned access in av7110.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Al Viro 2008-05-21 00:30:51 -03:00 committed by Mauro Carvalho Chehab
parent a230e55d92
commit 3e085629bc
1 changed files with 5 additions and 4 deletions

View File

@ -51,6 +51,7 @@
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <asm/unaligned.h>
#include <asm/system.h> #include <asm/system.h>
@ -1461,9 +1462,9 @@ static int check_firmware(struct av7110* av7110)
ptr += 4; ptr += 4;
/* check dpram file */ /* check dpram file */
crc = ntohl(*(u32*) ptr); crc = get_unaligned_be32(ptr);
ptr += 4; ptr += 4;
len = ntohl(*(u32*) ptr); len = get_unaligned_be32(ptr);
ptr += 4; ptr += 4;
if (len >= 512) { if (len >= 512) {
printk("dvb-ttpci: dpram file is way too big.\n"); printk("dvb-ttpci: dpram file is way too big.\n");
@ -1478,9 +1479,9 @@ static int check_firmware(struct av7110* av7110)
ptr += len; ptr += len;
/* check root file */ /* check root file */
crc = ntohl(*(u32*) ptr); crc = get_unaligned_be32(ptr);
ptr += 4; ptr += 4;
len = ntohl(*(u32*) ptr); len = get_unaligned_be32(ptr);
ptr += 4; ptr += 4;
if (len <= 200000 || len >= 300000 || if (len <= 200000 || len >= 300000 ||