From: Pavel Machek <pavel@ucw.cz>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Isaac Hazan <isaac.hazan@intel.com>,
Lee Jones <lee.jones@linaro.org>,
Rikard Falkeborn <rikard.falkeborn@gmail.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] led-class-flash: fix -Wrestrict warning
Date: Mon, 27 Sep 2021 12:31:37 +0200 [thread overview]
Message-ID: <20210927103137.GA25707@duo.ucw.cz> (raw)
In-Reply-To: <20210927101610.1669830-1-arnd@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]
Hi!
> Signed-off-by: Arnd Bergmann <arnd@arndb.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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
prev parent reply other threads:[~2021-09-27 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 10:15 [PATCH] led-class-flash: fix -Wrestrict warning Arnd Bergmann
2021-09-27 10:22 ` Greg Kroah-Hartman
2021-09-27 13:12 ` Arnd Bergmann
2021-09-27 10:31 ` Pavel Machek [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=20210927103137.GA25707@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=isaac.hazan@intel.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rikard.falkeborn@gmail.com \
/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