Skip to content

Commit

Permalink
watchdog: core: Fix devres_alloc() allocation size
Browse files Browse the repository at this point in the history
Coverity reports:

Passing argument 152UL /* sizeof (*wdd) */ to function __devres_alloc_node
and then casting the return value to struct watchdog_device ** is
suspicious.

Allocation size needs to be sizeof(*rcwdd), not sizeof(*wdd).

Fixes: 83fbae5 ("watchdog: Add a device managed API for ...")
Cc: Neil Armstrong <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
  • Loading branch information
groeck authored and Wim Van Sebroeck committed Sep 23, 2016
1 parent 3be7988 commit 2e91838
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/watchdog/watchdog_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ int devm_watchdog_register_device(struct device *dev,
struct watchdog_device **rcwdd;
int ret;

rcwdd = devres_alloc(devm_watchdog_unregister_device, sizeof(*wdd),
rcwdd = devres_alloc(devm_watchdog_unregister_device, sizeof(*rcwdd),
GFP_KERNEL);
if (!rcwdd)
return -ENOMEM;
Expand Down

0 comments on commit 2e91838

Please sign in to comment.