diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-12-24 15:42:05 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-07 14:48:46 +0400 |
commit | c0ee62734e8e840b0096827f02b1aaac71ef5105 (patch) | |
tree | 47869a1a50d362bc48d81b3e1be72b7d50e90036 /drivers/media/i2c | |
parent | 7296e158b5a3340f44b64c86240e07922406e1c3 (diff) | |
download | linux-c0ee62734e8e840b0096827f02b1aaac71ef5105.tar.xz |
[media] s5k5baf: Fix potential NULL pointer dereferencing
Dereference 'fw' after the NULL check.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/s5k5baf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c index 974b865c2ee1..4b8381111cbd 100644 --- a/drivers/media/i2c/s5k5baf.c +++ b/drivers/media/i2c/s5k5baf.c @@ -548,12 +548,14 @@ static void s5k5baf_synchronize(struct s5k5baf *state, int timeout, u16 addr) static u16 *s5k5baf_fw_get_seq(struct s5k5baf *state, u16 seq_id) { struct s5k5baf_fw *fw = state->fw; - u16 *data = fw->data + 2 * fw->count; + u16 *data; int i; if (fw == NULL) return NULL; + data = fw->data + 2 * fw->count; + for (i = 0; i < fw->count; ++i) { if (fw->seq[i].id == seq_id) return data + fw->seq[i].offset; |