All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev <netdev@vger.kernel.org>, Nicolas Pitre <nico@fluxnic.net>
Subject: Re: [PATCH net-next 6/7] drivers: net: smc911x: Fix cast from pointer to integer of different size
Date: Mon, 2 Nov 2020 15:47:45 -0800	[thread overview]
Message-ID: <20201102154745.39cd54ef@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> (raw)
In-Reply-To: <20201031004958.1059797-7-andrew@lunn.ch>

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@lunn.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.

  reply	other threads:[~2020-11-02 23:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31  0:49 [PATCH net-next 0/7] smsc W=1 warning fixes Andrew Lunn
2020-10-31  0:49 ` [PATCH net-next 1/7] drivers: net: smc91x: Fix set but unused W=1 warning Andrew Lunn
2020-10-31  0:49 ` [PATCH net-next 2/7] drivers: net: smc91x: Fix missing kerneldoc reported by W=1 Andrew Lunn
2020-10-31  0:49 ` [PATCH net-next 3/7] drivers: net: smc911x: Work around set but unused status Andrew Lunn
2020-10-31  0:49 ` [PATCH net-next 4/7] drivers: net: smc911x: Fix set but unused status because of DBG macro Andrew Lunn
2020-11-02 23:48   ` Jakub Kicinski
2020-10-31  0:49 ` [PATCH net-next 5/7] drivers: net: smc911x: Fix passing wrong number of parameters to DBG() macro Andrew Lunn
2020-10-31  0:49 ` [PATCH net-next 6/7] drivers: net: smc911x: Fix cast from pointer to integer of different size Andrew Lunn
2020-11-02 23:47   ` Jakub Kicinski [this message]
2020-11-03 10:16     ` David Laight
2020-10-31  0:49 ` [PATCH net-next 7/7] drivers: net: smsc: Add COMPILE_TEST support Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201102154745.39cd54ef@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    --cc=nico@fluxnic.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.