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

media: staging: atomisp: fix the uninitialized use in gc2235_detect()

Inside function gc2235_detect(), variable "low" could be uninitialized
if ov5693_read_reg() returns error, however, it affects the value of
variable "id". The "id" is used in the later if statement, which is
potentially unsafe.

Link: https://lore.kernel.org/linux-media/20210711202334.27959-1-yzhai003@ucr.edu
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Yizhuo and committed by
Mauro Carvalho Chehab
5ba9c067 e16f5e39

+2
+2
drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
··· 1714 1714 } 1715 1715 ret = ov5693_read_reg(client, OV5693_8BIT, 1716 1716 OV5693_SC_CMMN_CHIP_ID_L, &low); 1717 + if (ret) 1718 + return ret; 1717 1719 id = ((((u16)high) << 8) | (u16)low); 1718 1720 1719 1721 if (id != OV5693_ID) {