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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 30 Jun 2014 09:44:33 +0000 From: David Laight <David.Laight@...LAB.COM> To: 'Joe Perches' <joe@...ches.com>, "Maciej W. Rozycki" <macro@...ux-mips.org> CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org> Subject: RE: [PATCH] declance: Fix 64-bit compilation warnings From: Joe Perches > On Sat, 2014-06-28 at 23:57 +0100, Maciej W. Rozycki wrote: > > This fixes compiler warnings: > > > > drivers/net/ethernet/amd/declance.c: In function 'lance_init_ring': > > drivers/net/ethernet/amd/declance.c:478: warning: format '%8.8x' expects type 'unsigned int', but > argument 3 has type 'long unsigned int' > > drivers/net/ethernet/amd/declance.c:487: warning: format '%8.8x' expects type 'unsigned int', but > argument 3 has type 'long unsigned int' > > drivers/net/ethernet/amd/declance.c:503: warning: cast from pointer to integer of different size > > drivers/net/ethernet/amd/declance.c:520: warning: cast from pointer to integer of different size > > > > in 64-bit compilation. Where the value printed is an offset (whose range > > will always fit) the cast uses a 32-bit type, otherwise, where it is a > > host memory address, the `long' type is used and the width of the number > > printed adjusted according to the size of this type. > > > > Tested with both 32-bit and 64-bit compilation, as well as at the run time > > (with the debug messages affected enabled). > [] > > Index: net-next-20140424-4maxp64/drivers/net/ethernet/amd/declance.c > [] > > @@ -499,8 +499,9 @@ static void lance_init_ring(struct net_d > > /* The ones required by tmd2 */ > > *lib_ptr(ib, btx_ring[i].misc, lp->type) = 0; > > if (i < 3 && ZERO) > > - printk("%d: 0x%8.8x(0x%8.8x)\n", > > - i, leptr, (uint)lp->tx_buf_ptr_cpu[i]); > > + printk("%d: 0x%8.8x(%#0*lx)\n", > > + i, leptr, (int)sizeof(long), > > + (long)lp->tx_buf_ptr_cpu[i]); > > You need to adjust the "*" and sizeof(long) with +2 for the > 0x prefix in the output length here. Do you need all the leading zeros at all? David -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists