[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <277055c5-6e04-6e15-d2e8-9a81bb1f62cf@roeck-us.net>
Date: Sun, 29 Oct 2017 15:43:00 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Tomas Winkler <tomas.winkler@...el.com>,
Wim Van Sebroeck <wim@...ana.be>
Cc: linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [watchdog] watchdog: mei_wdt: don't use of variable length array
On 10/29/2017 12:51 AM, Tomas Winkler wrote:
> Fixes sparse warning:
> drivers/watchdog/mei_wdt.c:530:18: warning: Variable length array is used
>
> Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>
> Reviewed-by: Alexander Usyskin <alexander.usyskin@...el.com>
Reviewed-by: Guenter Roeck <linux@...ck-us.net>
> ---
> drivers/watchdog/mei_wdt.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/mei_wdt.c b/drivers/watchdog/mei_wdt.c
> index ea60b29494fb..b8194b02abe0 100644
> --- a/drivers/watchdog/mei_wdt.c
> +++ b/drivers/watchdog/mei_wdt.c
> @@ -526,12 +526,11 @@ static ssize_t mei_dbgfs_read_state(struct file *file, char __user *ubuf,
> size_t cnt, loff_t *ppos)
> {
> struct mei_wdt *wdt = file->private_data;
> - const size_t bufsz = 32;
> - char buf[bufsz];
> + char buf[32];
> ssize_t pos;
>
> - pos = scnprintf(buf, bufsz, "state: %s\n",
> - mei_wdt_state_str(wdt->state));
> + pos = scnprintf(buf, sizeof(buf), "state: %s\n",
> + mei_wdt_state_str(wdt->state));
>
> return simple_read_from_buffer(ubuf, cnt, ppos, buf, pos);
> }
>
Powered by blists - more mailing lists