From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 713A5C433EF for ; Mon, 27 Sep 2021 10:31:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58A5961074 for ; Mon, 27 Sep 2021 10:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233831AbhI0KdR (ORCPT ); Mon, 27 Sep 2021 06:33:17 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:57166 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbhI0KdQ (ORCPT ); Mon, 27 Sep 2021 06:33:16 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id A61B81C0B7A; Mon, 27 Sep 2021 12:31:37 +0200 (CEST) Date: Mon, 27 Sep 2021 12:31:37 +0200 From: Pavel Machek To: Arnd Bergmann Cc: Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Arnd Bergmann , Greg Kroah-Hartman , Isaac Hazan , Lee Jones , Rikard Falkeborn , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH] led-class-flash: fix -Wrestrict warning Message-ID: <20210927103137.GA25707@duo.ucw.cz> References: <20210927101610.1669830-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <20210927101610.1669830-1-arnd@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Signed-off-by: Arnd Bergmann > --- > drivers/leds/led-class-flash.c | 2 +- > drivers/thunderbolt/xdomain.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flas= h.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 <<=3D 1; > } > =20 > - 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, stru= ct device_attribute *attr, > =20 > /* 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); > =20 > --=20 > 2.29.2 --=20 http://www.livejournal.com/~pavelmachek --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYVGdiQAKCRAw5/Bqldv6 8kRqAJwJEv2ANUJy1EMUAfdG56oMdJDwWQCeL/coOb+Z8MwJj2Y8AliUkjk6JS8= =On5G -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY--