Skip to content

Commit 1821b79

Browse files
Colin Ian Kingalexandrebelloni
authored andcommitted
rtc: ds1307: check for failed memory allocation on wdt
Currently a failed memory allocation will lead to a null pointer dereference on point wdt. Fix this by checking for a failed allocation and just returning. Addresses-Coverity: ("Dereference null return") Fixes: fd90d48 ("rtc: ds1307: add support for watchdog timer on ds1388") Signed-off-by: Colin Ian King <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 3edf29d commit 1821b79

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/rtc/rtc-ds1307.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,8 @@ static void ds1307_wdt_register(struct ds1307 *ds1307)
16731673
return;
16741674

16751675
wdt = devm_kzalloc(ds1307->dev, sizeof(*wdt), GFP_KERNEL);
1676+
if (!wdt)
1677+
return;
16761678

16771679
wdt->info = &ds1388_wdt_info;
16781680
wdt->ops = &ds1388_wdt_ops;

0 commit comments

Comments
 (0)