net: ni65: Avoid typecast of pointer to u32
Subsystems (2)
PATCH 1/1 net: ni65: Avoid typecast of pointer to u32
Building alpha:allmodconfig results in the following error.
drivers/net/ethernet/amd/ni65.c: In function 'ni65_stop_start':drivers/net/ethernet/amd/ni65.c:751:37: error:
cast from pointer to integer of different size buffer[i] = (u32) isa_bus_to_virt(tmdp->u.buffer);
'buffer[]' is declared as unsigned long, so replace the typecast to u32 with a typecast to unsigned long to fix the problem.
--- drivers/net/ethernet/amd/ni65.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/ni65.c +1 -1
@@ -748,7 +748,7 @@ static void ni65_stop_start(struct net_device *dev,struct priv *p)#ifdef XMT_VIA_SKB skb_save[i] = p->tmd_skb[i];#endif - buffer[i] = (u32 )isa_bus_to_virt (tmdp->u.buffer); + buffer[i] = (unsigned long )isa_bus_to_virt (tmdp->u.buffer); blen[i] = tmdp->blen; tmdp->u.s.status =0x0 ; }
Signature · 1 line
2.33.0
Quoted 8 lines · Guenter Roeck
Building alpha:allmodconfig results in the following error.
drivers/net/ethernet/amd/ni65.c: In function 'ni65_stop_start':drivers/net/ethernet/amd/ni65.c:751:37: error:
cast from pointer to integer of different size
buffer[i] = (u32)isa_bus_to_virt(tmdp->u.buffer);
Quoted 5 lines
'buffer[]' is declared as unsigned long, so replace the typecast to u32 with a typecast to unsigned long to fix the problem.
Cc Arnd Bergmann <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Quoted 9 lines
--- drivers/net/ethernet/amd/ni65.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/amd/ni65.c +0
-0
drivers/net/ethernet/amd/ni65.c static void ni65_stop_start(struct net_device *dev,struct priv *p) · line 751
Quoted 5 lines
drivers/net/ethernet/amd/ni65.c +1
-1@@ -748,7 +748,7 @@ static void ni65_stop_start(struct net_device *dev,struct priv *p)#ifdef XMT_VIA_SKB skb_save[i] = p->tmd_skb[i];#endif - buffer[i] = (u32 )isa_bus_to_virt (tmdp->u.buffer); + buffer[i] = (unsigned long )isa_bus_to_virt (tmdp->u.buffer);
I generally prefer uintptr_t over unsigned long for this cast because it's more descriptive, but the effect is the same.
Arnd
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 8 lines · On Wed, 8 Sep 2021 21:49:53 -0700 you wrote:
Building alpha:allmodconfig results in the following error.
drivers/net/ethernet/amd/ni65.c: In function 'ni65_stop_start':drivers/net/ethernet/amd/ni65.c:751:37: error:cast from pointer to integer of different size buffer[i] = (u32) isa_bus_to_virt(tmdp->u.buffer);[...]
Here is the summary with links:
- net: ni65: Avoid typecast of pointer to u32
https://git.kernel.org/netdev/net/c/e011912651bd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html