mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-10 11:25:18 +02:00
rtc: nct3018y: fix possible NULL dereference
[ Upstream commit babfeb9cbe
]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
664ad87c36
commit
454ba1740c
|
@ -99,6 +99,8 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala
|
||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
return flags;
|
return flags;
|
||||||
*alarm_enable = flags & NCT3018Y_BIT_AIE;
|
*alarm_enable = flags & NCT3018Y_BIT_AIE;
|
||||||
|
dev_dbg(&client->dev, "%s:alarm_enable:%x\n", __func__, *alarm_enable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alarm_flag) {
|
if (alarm_flag) {
|
||||||
|
@ -107,11 +109,9 @@ static int nct3018y_get_alarm_mode(struct i2c_client *client, unsigned char *ala
|
||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
return flags;
|
return flags;
|
||||||
*alarm_flag = flags & NCT3018Y_BIT_AF;
|
*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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user