diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2024-02-29 23:21:27 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2024-03-08 12:01:21 +0100 |
commit | babfeb9cbe7ebc657bd5b3e4f9fde79f560b6acc (patch) | |
tree | 3752e989e917e88b364cf4247be86043b86774fc /drivers/rtc/rtc-nct3018y.c | |
parent | c12e67e076cbcb86fd9c3cb003a344ec684138a6 (diff) | |
download | linux-stable-babfeb9cbe7ebc657bd5b3e4f9fde79f560b6acc.tar.gz linux-stable-babfeb9cbe7ebc657bd5b3e4f9fde79f560b6acc.tar.bz2 linux-stable-babfeb9cbe7ebc657bd5b3e4f9fde79f560b6acc.zip |
rtc: nct3018y: fix possible NULL dereference
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 <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202305180042.DEzW1pSd-lkp@intel.com/
Link: https://lore.kernel.org/r/20240229222127.1878176-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-nct3018y.c')
-rw-r--r-- | drivers/rtc/rtc-nct3018y.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-nct3018y.c b/drivers/rtc/rtc-nct3018y.c index f488a189a465..076d8b99f913 100644 --- a/drivers/rtc/rtc-nct3018y.c +++ b/drivers/rtc/rtc-nct3018y.c @@ -102,6 +102,8 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala if (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 *ala if (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; } |