提交 89d6e45c 编写于 作者: M Mauro Carvalho Chehab

media: sp887x: fix a warning

drivers/media/dvb-frontends/sp887x.c:179 sp887x_initial_setup() error: memcpy() '&buf[2]' too small (30 vs 16384)

This is actually a false alarm, but reverting the check order
makes not only for humans to review the code, but also cleans
the warning.
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 912d2f82
...@@ -136,7 +136,7 @@ static void sp887x_setup_agc (struct sp887x_state* state) ...@@ -136,7 +136,7 @@ static void sp887x_setup_agc (struct sp887x_state* state)
static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware *fw) static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware *fw)
{ {
struct sp887x_state* state = fe->demodulator_priv; struct sp887x_state* state = fe->demodulator_priv;
u8 buf [BLOCKSIZE+2]; u8 buf [BLOCKSIZE + 2];
int i; int i;
int fw_size = fw->size; int fw_size = fw->size;
const unsigned char *mem = fw->data; const unsigned char *mem = fw->data;
...@@ -144,7 +144,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware ...@@ -144,7 +144,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware
dprintk("%s\n", __func__); dprintk("%s\n", __func__);
/* ignore the first 10 bytes, then we expect 0x4000 bytes of firmware */ /* ignore the first 10 bytes, then we expect 0x4000 bytes of firmware */
if (fw_size < FW_SIZE+10) if (fw_size < FW_SIZE + 10)
return -ENODEV; return -ENODEV;
mem = fw->data + 10; mem = fw->data + 10;
...@@ -167,7 +167,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware ...@@ -167,7 +167,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware
int c = BLOCKSIZE; int c = BLOCKSIZE;
int err; int err;
if (i+c > FW_SIZE) if (c > FW_SIZE - i)
c = FW_SIZE - i; c = FW_SIZE - i;
/* bit 0x8000 in address is set to enable 13bit mode */ /* bit 0x8000 in address is set to enable 13bit mode */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册