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:	Wed, 23 Mar 2016 17:51:11 +0100
From:	Andrew Lunn <andrew@...n.ch>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Jiri Pirko <jiri@...lanox.com>, Ido Schimmel <idosch@...lanox.com>,
	"David S. Miller" <davem@...emloft.net>,
	Elad Raz <eladr@...lanox.com>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: mlxsw: avoid unused variable warnings

On Wed, Mar 23, 2016 at 05:37:38PM +0100, Arnd Bergmann wrote:
> dev_dbg_ratelimited() is a macro that ignores its arguments when DEBUG is
> not set, which can lead to unused variable warnings:
> 
> ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_sdq_handle':
> ethernet/mellanox/mlxsw/pci.c:646:18: warning: unused variable 'pdev' [-Wunused-variable]
> ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_rdq_handle':
> ethernet/mellanox/mlxsw/pci.c:671:18: warning: unused variable 'pdev' [-Wunused-variable]
> 
> This changes the mlxsw driver to remove the local variables we get
> warnings for and instead pass the device directly into the API.

Hi Arnd

Would it not be better to fix the macro?

I think the issue is that dev_dbg_ratelimited calls no_printk(),
without making use of dev. So how about:

#define dev_dbg_ratelimited(dev, fmt, ...)                              \
({                                                                      \
        if (0)                                                          \
                dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__);        \
})

This follows the pattern for other macros for when DEBUG is not defined.

      Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ