[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210927103137.GA25707@duo.ucw.cz>
Date: Mon, 27 Sep 2021 12:31:37 +0200
From: Pavel Machek <pavel@....cz>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Andreas Noever <andreas.noever@...il.com>,
Michael Jamet <michael.jamet@...el.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Yehezkel Bernat <YehezkelShB@...il.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Isaac Hazan <isaac.hazan@...el.com>,
Lee Jones <lee.jones@...aro.org>,
Rikard Falkeborn <rikard.falkeborn@...il.com>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: Re: [PATCH] led-class-flash: fix -Wrestrict warning
Hi!
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/leds/led-class-flash.c | 2 +-
> drivers/thunderbolt/xdomain.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
> index 185e17055317..6fe9d700dfef 100644
> --- a/drivers/leds/led-class-flash.c
> +++ b/drivers/leds/led-class-flash.c
> @@ -207,7 +207,7 @@ static ssize_t flash_fault_show(struct device *dev,
> mask <<= 1;
> }
>
> - return sprintf(buf, "%s\n", buf);
> + return strlen(strcat(buf, "\n"));
> }
> static DEVICE_ATTR_RO(flash_fault);
>
That's not just a warning. .. the code is crazy. I'll take it if you
split it from the thunderbolt change.
Best regards,
Pavel
> diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
> index d66ea4d616fd..eff32499610f 100644
> --- a/drivers/thunderbolt/xdomain.c
> +++ b/drivers/thunderbolt/xdomain.c
> @@ -730,7 +730,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>
> /* Full buffer size except new line and null termination */
> get_modalias(svc, buf, PAGE_SIZE - 2);
> - return sprintf(buf, "%s\n", buf);
> + return strlen(strcat(buf, "\n"));
> }
> static DEVICE_ATTR_RO(modalias);
>
> --
> 2.29.2
--
http://www.livejournal.com/~pavelmachek
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists