Skip to contentSkip to conversation

Add driver for Samsung S5K5BAF camera sensor

media Dan Carpenter 2 participants 2 messages Jan 8, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello Andrzej Hajda,

This is a semi-automatic email about new static checker warnings.

The patch 7d459937dc09: "[media] Add driver for Samsung S5K5BAF camera sensor" from Dec 5, 2013, leads to the following Smatch complaint:

drivers/media/i2c/s5k5baf.c:554 s5k5baf_fw_get_seq()
warn: variable dereferenced before check 'fw' (see line 551)

drivers/media/i2c/s5k5baf.c
550 struct s5k5baf_fw *fw = state->fw;

   551		u16 *data = fw->data + 2 * fw->count;
                                           ^^^^^^^^^

Dereference.

552 int i;
553
554 if (fw == NULL)

                    ^^^^^^^^^^

Check.

555 return NULL;
556

regards,
dan carpenter

#1 lore raw

Hi Dan,

Quoted 17 lines · Dan Carpenter

Hello Andrzej Hajda,

This is a semi-automatic email about new static checker warnings.

The patch 7d459937dc09: "[media] Add driver for Samsung S5K5BAF camera sensor" from Dec 5, 2013, leads to the following Smatch complaint:

drivers/media/i2c/s5k5baf.c:554 s5k5baf_fw_get_seq()
warn: variable dereferenced before check 'fw' (see line 551)

drivers/media/i2c/s5k5baf.c

   550          struct s5k5baf_fw *fw = state->fw;
   551          u16 *data = fw->data + 2 * fw->count;
                                           ^^^^^^^^^

Dereference.

Quoted 9 lines
   552          int i;
   553
   554          if (fw == NULL)
                    ^^^^^^^^^^

Check.

   555                  return NULL;
   556

A patch [1] to fix this has already been queued up by Mauro.

[1] https://linuxtv.org/patch/21292/

Signature · 2 lines
With warm regards,
Sachin