public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: isl6421: fix possible uninitialized-variable access in isl6421_set_voltage()
@ 2021-07-31  7:38 Tuo Li
  2021-11-19 16:28 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 2+ messages in thread
From: Tuo Li @ 2021-07-31  7:38 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, baijiaju1990, Tuo Li, TOTE Robot

A memory block is allocated through kmalloc(), and its return value is
assigned to the pointer isl6421. Then isl6421 is assigned to the
varialbe fe->sec_priv. The function isl6421_set_voltage() is called with
the argument fe. In this function, fe->sec_priv is assigned to isl6421.
Thus the pointer isl6421 in the function isl6421_attach() and the function
isl6421_set_voltage() point to the same memory. However, isl6421->is_off
is not initialized but it is accessed at line 75:
  if (isl6421->is_off && !is_off)

To fix this possible uninitialized-variable access, isl6421->is_off is
initialized to false in the function isl6421_attach().

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
---
 drivers/media/dvb-frontends/isl6421.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/dvb-frontends/isl6421.c b/drivers/media/dvb-frontends/isl6421.c
index 43b0dfc6f453..ea101f66ea88 100644
--- a/drivers/media/dvb-frontends/isl6421.c
+++ b/drivers/media/dvb-frontends/isl6421.c
@@ -185,6 +185,7 @@ struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter
 	isl6421->config = ISL6421_ISEL1;
 	isl6421->i2c = i2c;
 	isl6421->i2c_addr = i2c_addr;
+	isl6421->is_off = false;
 	fe->sec_priv = isl6421;
 
 	/* bits which should be forced to '1' */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-19 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-31  7:38 [PATCH] media: isl6421: fix possible uninitialized-variable access in isl6421_set_voltage() Tuo Li
2021-11-19 16:28 ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox