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:	Tue, 30 Nov 2010 10:22:57 -0800
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	Andres Salomon <dilinger@...ued.net>
Cc:	Stephen Rothwell <sfr@...b.auug.org.au>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	linux-next@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cs5535-mfd: fix warning on x86-64

On Mon, 29 Nov 2010 20:44:10 -0800 Andres Salomon wrote:

> On Mon, 29 Nov 2010 11:52:57 +1100
> Stephen Rothwell <sfr@...b.auug.org.au> wrote:
> 
> > Hi Samuel,
> > 
> > After merging the mfd tree, today's linux-next build (x86_64
> > allmodconfig) produced this warning:
> > 
> > drivers/mfd/cs5535-mfd.c: In function 'cs5535_mfd_probe':
> > drivers/mfd/cs5535-mfd.c:106: warning: format '%d' expects type
> > 'int', but argument 3 has type 'long unsigned int'
> > 
> 
> Ick, ARRAY_SIZE is unsigned int on x86, unsigned long on x86-64.  The
> patch below fixes this.
> 

No, it's a sizeof(), so it should be printed with %zd.
That works on x86_64 or i386.

> 
> 
> 
> From: Andres Salomon <dilinger@...ued.net>
> 
> ARRAY_SIZE() returns unsigned long on x86-64 (rather than unsigned int);
> cast it to the desired type to shut gcc up.
> 
> Signed-off-by: Andres Salomon <dilinger@...ued.net>
> ---
>  drivers/mfd/cs5535-mfd.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
> index b141ca7..e6f7ebc 100644
> --- a/drivers/mfd/cs5535-mfd.c
> +++ b/drivers/mfd/cs5535-mfd.c
> @@ -103,8 +103,8 @@ static int __devinit cs5535_mfd_probe(struct pci_dev *pdev,
>  		goto err_disable;
>  	}
>  
> -	dev_info(&pdev->dev, "%d devices registered.\n",
> -			ARRAY_SIZE(cs5535_mfd_cells));
> +	dev_info(&pdev->dev, "%u devices registered.\n",
> +			(unsigned int) ARRAY_SIZE(cs5535_mfd_cells));
>  
>  	return 0;
>  
> -- 
> 1.7.2.3
> 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
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