Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Sachin Kamat and committed by
Mauro Carvalho Chehab
c0ee6273 7296e158

+3 -1
+3 -1
drivers/media/i2c/s5k5baf.c
··· 548 548 static u16 *s5k5baf_fw_get_seq(struct s5k5baf *state, u16 seq_id) 549 549 { 550 550 struct s5k5baf_fw *fw = state->fw; 551 - u16 *data = fw->data + 2 * fw->count; 551 + u16 *data; 552 552 int i; 553 553 554 554 if (fw == NULL) 555 555 return NULL; 556 + 557 + data = fw->data + 2 * fw->count; 556 558 557 559 for (i = 0; i < fw->count; ++i) { 558 560 if (fw->seq[i].id == seq_id)