Re: [PATCH 1/2] net: ethernet: 3c515: Fix cast from pointer to integer of different size
From: Krzysztof Kozlowski
Date: Tue Jan 07 2020 - 03:35:55 EST
On Mon, Jan 06, 2020 at 01:31:55PM -0800, David Miller wrote:
> From: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
> Date: Sat, 4 Jan 2020 15:33:05 +0100
> > Pointer passed as integer should be cast to unsigned long to
> > avoid warning (compile testing on alpha architecture):
> > drivers/net/ethernet/3com/3c515.c: In function âcorkscrew_start_xmitâ:
> > drivers/net/ethernet/3com/3c515.c:1066:8: warning:
> > cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > Signed-off-by: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
> > ---
> > Only compile tested
> Sorry, I'm not applying these two.
> It is clear that these drivers only work properly on 32-bit architectures
> where virtual address equals the DMA address.
> Making this warning goes away creates a false sense that they are in
> fact 64-bit clean and capable, they are not.
The existing casts are clearly wrong - the convention is that pointer
should be cast to unsigned long, not int. In the second case it is even
weirder - the buffer array is actually unsigned long so the cast is
However I understand your argument that these casts serve as a
documentation purpose of only 32-bit support, so let it be.