Re: [PATCH] watchdog: core: Fix devres_alloc() allocation size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/10/2016 07:34 AM, Guenter Roeck wrote:
> 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: 83fbae5a148c ("watchdog: Add a device managed API for ...")
> Cc: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> ---
>  drivers/watchdog/watchdog_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 6abb83cd7681..74265b2f806c 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
> @@ -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;
> 

My bad...

Acked-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux