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]
Date:   Mon, 22 Mar 2021 11:29:27 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Johannes Berg <johannes@...solutions.net>,
        Arnd Bergmann <arnd@...db.de>,
        Randy Dunlap <rdunlap@...radead.org>,
        Matthew Wilcox <willy@...radead.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] devcoredump: avoid -Wempty-body warnings

On Mon, Mar 22, 2021 at 11:19:53AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> Cleaning out the last -Wempty-body warnings found some interesting
> cases with empty macros, along with harmless warnings like this one:
> 
> drivers/base/devcoredump.c: In function 'dev_coredumpm':
> drivers/base/devcoredump.c:297:56: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
>   297 |                 /* nothing - symlink will be missing */;
>       |                                                        ^
> drivers/base/devcoredump.c:301:56: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
>   301 |                 /* nothing - symlink will be missing */;
>       |                                                        ^
> 
> Randy tried addressing this one before, and there were multiple
> other ideas in that thread.
> 
> Pick up the one that Matthew Wilcox suggested by adding a
> WARN_ON_ONCE() and a comment.
> 
> Link: https://lore.kernel.org/lkml/20200418184111.13401-8-rdunlap@infradead.org/
> Cc: Randy Dunlap <rdunlap@...radead.org>
> Cc: Matthew Wilcox <willy@...radead.org>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/base/devcoredump.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
> index 9243468e2c99..88e0d931439e 100644
> --- a/drivers/base/devcoredump.c
> +++ b/drivers/base/devcoredump.c
> @@ -292,13 +292,16 @@ void dev_coredumpm(struct device *dev, struct module *owner,
>  	if (device_add(&devcd->devcd_dev))
>  		goto put_device;
>  
> -	if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj,
> -			      "failing_device"))
> -		/* nothing - symlink will be missing */;
> +	/*
> +	 * These should normally not fail, but there is no problem
> +	 * continuing without the links, so just warn instead of
> +	 * failing.
> +	 */
> +	WARN_ON_ONCE(sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj,
> +				       "failing_device"));
>  
> -	if (sysfs_create_link(&dev->kobj, &devcd->devcd_dev.kobj,
> -			      "devcoredump"))
> -		/* nothing - symlink will be missing */;
> +	WARN_ON_ONCE(sysfs_create_link(&dev->kobj, &devcd->devcd_dev.kobj,
> +				       "devcoredump"));

We do not want to reboot machines that have panic-on-warn set, so if
this really needs a trace dump, please do that instead...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ