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, 15 Apr 2009 14:32:28 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Zhenwen Xu <helight.xu@...il.com>
Cc:	sean.hefty@...el.com, hal.rosenstock@...il.com,
	general@...ts.openfabrics.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fix a warning on
 drivers/infiniband/hw/nes/nes_cm.c:862:

On Sun, 12 Apr 2009 20:23:17 +0800
Zhenwen Xu <helight.xu@...il.com> wrote:

> Fix this warning:
> drivers/infiniband/hw/nes/nes_cm.c:862: warning: unused variable ___tmp_addr___
> 
> the 'tmp_addr' is defined for debug, so it should be defined in
> CONFIG_INFINIBAND_NES_DEBUG
> 
> 
> >From 5f67884bcda5450807dcd080378d829628e4db1c Mon Sep 17 00:00:00 2001
> From: Zhenwen Xu <Helight.Xu@...il.com>
> Date: Sun, 12 Apr 2009 20:12:18 +0800
> Subject: [PATCH] fix a warning on drivers/infiniband/hw/nes/nes_cm.c:862:
> 
> Signed-off-by: Zhenwen Xu <helight.xu@...il.com>
> ---
>  drivers/infiniband/hw/nes/nes_cm.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
> index dbd9a75..1bad93b 100644
> --- a/drivers/infiniband/hw/nes/nes_cm.c
> +++ b/drivers/infiniband/hw/nes/nes_cm.c
> @@ -854,8 +854,9 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
>  {
>  	unsigned long flags;
>  	struct nes_cm_listener *listen_node;
> +#ifdef CONFIG_INFINIBAND_NES_DEBUG
>  	__be32 tmp_addr = cpu_to_be32(dst_addr);
> -
> +#endif
>  	/* walk list and find cm_node associated with this session ID */
>  	spin_lock_irqsave(&cm_core->listen_list_lock, flags);
>  	list_for_each_entry(listen_node, &cm_core->listen_list.list, list) {

eek, an ugly ifdef.  And we can't just remove tmp_addr because
printk(%p) wants to be passed an address rather than a value.

It'd be nice if we had a handy macro to squish the warning, like
uninitialized_var.

As it happens, uninitialized_var() _does_ suppress the unused-var warning:

--- a/drivers/infiniband/hw/nes/nes_cm.c~drivers-infiniband-hw-nes-nes_cmc-fix-unused-var-warning-cleanup
+++ a/drivers/infiniband/hw/nes/nes_cm.c
@@ -854,9 +854,8 @@ static struct nes_cm_listener *find_list
 {
 	unsigned long flags;
 	struct nes_cm_listener *listen_node;
-#ifdef CONFIG_INFINIBAND_NES_DEBUG
-	__be32 tmp_addr = cpu_to_be32(dst_addr);
-#endif
+	__be32 uninitialized_var(tmp_addr) = cpu_to_be32(dst_addr);
+
 	/* walk list and find cm_node associated with this session ID */
 	spin_lock_irqsave(&cm_core->listen_list_lock, flags);
 	list_for_each_entry(listen_node, &cm_core->listen_list.list, list) {


but that seems a bit abusive ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ