[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201102154745.39cd54ef@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date: Mon, 2 Nov 2020 15:47:45 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev <netdev@...r.kernel.org>, Nicolas Pitre <nico@...xnic.net>
Subject: Re: [PATCH net-next 6/7] drivers: net: smc911x: Fix cast from
pointer to integer of different size
On Sat, 31 Oct 2020 01:49:57 +0100 Andrew Lunn wrote:
> drivers/net/ethernet/smsc/smc911x.c: In function ‘smc911x_hardware_send_pkt’:
> drivers/net/ethernet/smsc/smc911x.c:471:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 471 | cmdA = (((u32)skb->data & 0x3) << 16) |
>
> When built on 64bit targets, the skb->data pointer cannot be cast to a
> u32 in a meaningful way. Use long instead.
>
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> ---
> drivers/net/ethernet/smsc/smc911x.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
> index 4ec292563f38..f37832540364 100644
> --- a/drivers/net/ethernet/smsc/smc911x.c
> +++ b/drivers/net/ethernet/smsc/smc911x.c
> @@ -466,9 +466,9 @@ static void smc911x_hardware_send_pkt(struct net_device *dev)
> TX_CMD_A_INT_FIRST_SEG_ | TX_CMD_A_INT_LAST_SEG_ |
> skb->len;
> #else
> - buf = (char*)((u32)skb->data & ~0x3);
> - len = (skb->len + 3 + ((u32)skb->data & 3)) & ~0x3;
> - cmdA = (((u32)skb->data & 0x3) << 16) |
> + buf = (char *)((long)skb->data & ~0x3);
> + len = (skb->len + 3 + ((long)skb->data & 3)) & ~0x3;
> + cmdA = (((long)skb->data & 0x3) << 16) |
Probably best if you swap the (long) for something unsigned here as
well.
Powered by blists - more mailing lists