Commit 66503ec3 authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

watchdog: core: Fix devres_alloc() allocation size

commit 2e91838b upstream.

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: 83fbae5a ("watchdog: Add a device managed API for ...")
Cc: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c5e9e5cc
...@@ -349,7 +349,7 @@ int devm_watchdog_register_device(struct device *dev, ...@@ -349,7 +349,7 @@ int devm_watchdog_register_device(struct device *dev,
struct watchdog_device **rcwdd; struct watchdog_device **rcwdd;
int ret; int ret;
rcwdd = devres_alloc(devm_watchdog_unregister_device, sizeof(*wdd), rcwdd = devres_alloc(devm_watchdog_unregister_device, sizeof(*rcwdd),
GFP_KERNEL); GFP_KERNEL);
if (!rcwdd) if (!rcwdd)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment