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: <Y6XDAiMAMLniR9PG@kroah.com>
Date:   Fri, 23 Dec 2022 16:02:26 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Ammar Faizi <ammarfaizi2@...weeb.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>,
        LLVM Mailing List <llvm@...ts.linux.dev>
Subject: Re: [PATCH v1] driver core: Silence 'unused-but-set variable' warning

On Fri, Dec 23, 2022 at 09:51:37PM +0700, Ammar Faizi wrote:
> From: Ammar Faizi <ammarfaizi2@...weeb.org>
> 
> Compiling with clang-16:
> 
>   drivers/base/module.c:36:6: error: variable 'no_warn' set but not \
>   used [-Werror,-Wunused-but-set-variable]
>           int no_warn;
>               ^
>   1 error generated.
> 
> A reason the @no_warn variable exists is:
> sysfs_create_link() return value needs not be ignored to silence
> another warning.
> 
> So don't remove @no_warn, but add a '(void)no_warn;'.
> 
> Cc: LLVM Mailing List <llvm@...ts.linux.dev>
> Signed-off-by: Ammar Faizi <ammarfaizi2@...weeb.org>
> ---
>  drivers/base/module.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/base/module.c b/drivers/base/module.c
> index 46ad4d636731..42f0b3b9e7f8 100644
> --- a/drivers/base/module.c
> +++ b/drivers/base/module.c
> @@ -59,22 +59,23 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
>  		return;
>  
>  	/* Don't check return codes; these calls are idempotent */
>  	no_warn = sysfs_create_link(&drv->p->kobj, &mk->kobj, "module");
>  	driver_name = make_driver_name(drv);
>  	if (driver_name) {
>  		module_create_drivers_dir(mk);
>  		no_warn = sysfs_create_link(mk->drivers_dir, &drv->p->kobj,
>  					    driver_name);
>  		kfree(driver_name);
>  	}
> +	(void)no_warn;

Ick, no, that's horrid and is NOT ok for kernel code, sorry.

Please fix the compiler, this is not a "fix" in any sense of the word
and is not going to work at all for kernel code.

sorry,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ