diff mbox series

net: ni65: Avoid typecast of pointer to u32

Message ID 20210909044953.1564070-1-linux@roeck-us.net (mailing list archive)
State Accepted
Commit e011912651bdf72840d88e8a8de3716bbcc4be99
Delegated to: Netdev Maintainers
Headers show
Series net: ni65: Avoid typecast of pointer to u32 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 2 maintainers not CCed: arnd@arndb.de tanghui20@huawei.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 83 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Guenter Roeck Sept. 9, 2021, 4:49 a.m. UTC
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.

Cc: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/net/ethernet/amd/ni65.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnd Bergmann Sept. 9, 2021, 8:15 a.m. UTC | #1
On Thu, Sep 9, 2021 at 6:50 AM Guenter Roeck <linux@roeck-us.net> 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);
>
> '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 <arnd@kernel.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Arnd Bergmann <arnd@arndb.de>

> ---
>  drivers/net/ethernet/amd/ni65.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/amd/ni65.c b/drivers/net/ethernet/amd/ni65.c
> index b5df7ad5a83f..032e8922b482 100644
> --- a/drivers/net/ethernet/amd/ni65.c
> +++ b/drivers/net/ethernet/amd/ni65.c
> @@ -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
patchwork-bot+netdevbpf@kernel.org Sept. 9, 2021, 10:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

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
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/ni65.c b/drivers/net/ethernet/amd/ni65.c
index b5df7ad5a83f..032e8922b482 100644
--- a/drivers/net/ethernet/amd/ni65.c
+++ b/drivers/net/ethernet/amd/ni65.c
@@ -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;
 		}