lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YVGbU1lYp6/5HyRy@kroah.com>
Date:   Mon, 27 Sep 2021 12:22:11 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Pavel Machek <pavel@....cz>,
        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>,
        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

On Mon, Sep 27, 2021 at 12:15:59PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> drivers/leds/led-class-flash.c: In function 'flash_fault_show':
> drivers/leds/led-class-flash.c:210:16: error: 'sprintf' argument 3 overlaps destination object 'buf' [-Werror=restrict]
>   210 |         return sprintf(buf, "%s\n", buf);
>       |                ^~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/leds/led-class-flash.c:187:54: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
>   187 |                 struct device_attribute *attr, char *buf)
>       |                                                ~~~~~~^~~
> cc1: all warnings being treated as errors
> make[5]: *** [scripts/Makefile.build:277: drivers/leds/led-class-flash.o] Error 1
> make[5]: Target '__build' not remade because of errors.
> make[4]: *** [scripts/Makefile.build:540: drivers/leds] Error 2
> drivers/thunderbolt/xdomain.c: In function 'modalias_show':
> drivers/thunderbolt/xdomain.c:733:16: error: 'sprintf' argument 3 overlaps destination object 'buf' [-Werror=restrict]
>   733 |         return sprintf(buf, "%s\n", buf);
>       |                ^~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/thunderbolt/xdomain.c:727:36: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
>   727 |                              char *buf)
>       |                              ~~~~~~^~~
> 
> 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);
>  
> 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
> 

You also have a thunderbolt change in here as well :(

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ