mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Guenter Roeck <linux@roeck-us.net>, Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: core: Fix devres_alloc() allocation size
Date: Thu, 11 Aug 2016 10:36:22 +0200	[thread overview]
Message-ID: <78e269eb-93c0-dc2c-7a65-75380242ce66@baylibre.com> (raw)
In-Reply-To: <1470807271-8723-1-git-send-email-linux@roeck-us.net>

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@baylibre.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  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@baylibre.com>

      reply	other threads:[~2016-08-11  8:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  5:34 Guenter Roeck
2016-08-11  8:36 ` Neil Armstrong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78e269eb-93c0-dc2c-7a65-75380242ce66@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®