rtc: nct3018y: fix possible NULL dereference
Subsystems (2)
[email protected]
maintainerPATCH 1/1 rtc: nct3018y: fix possible NULL dereference
From: Alexandre Belloni <[email protected]>
alarm_enable and alarm_flag are allowed to be NULL but will be dereferenced later by the dev_dbg call.
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Alexandre Belloni <[email protected]>
--- drivers/rtc/rtc-nct3018y.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/rtc/rtc-nct3018y.c +3 -3
@@ -102,6 +102,8 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *alaif (flags <0 )return flags; *alarm_enable = flags &NCT3018Y_BIT_AIE ; +dev_dbg (&client->dev,"%s:alarm_enable:%x\n" , __func__, *alarm_enable); + }if (alarm_flag) {
@@ -110,11 +112,9 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *alaif (flags <0 )return flags; *alarm_flag = flags &NCT3018Y_BIT_AF ; +dev_dbg (&client->dev,"%s:alarm_flag:%x\n" , __func__, *alarm_flag); } -dev_dbg (&client->dev,"%s:alarm_enable:%x alarm_flag:%x\n" , - __func__, *alarm_enable, *alarm_flag); -return 0 ; }
Signature · 1 line
2.43.0