Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1286628

RE: [PATCH] net: ezchip: fix address space confusion in nps_enet.c

From Noam Camus <noamc@ezchip.com>
Newsgroups linux.kernel
Subject RE: [PATCH] net: ezchip: fix address space confusion in nps_enet.c
Date 2015-12-08 17:00 +0100
Message-ID <qDsQi-4f7-35@gated-at.bofh.it> (permalink)
References <qDsnf-44U-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>From: Arnd Bergmann [mailto:arnd@arndb.de] 
>Sent: Tuesday, December 08, 2015 5:29 PM
>To: David S. Miller
>Cc: Noam Camus; Tal Zilcer; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org
>Subject: [PATCH] net: ezchip: fix address space confusion in nps_enet.c

>The nps_enet driver happily mixes virtual, physical and __iomem addresses, which are all different depending on the architecture and configuration.  That causes a warning when building the code on ARM with LPAE mode enabled:

>drivers/net/ethernet/ezchip/nps_enet.c: In function 'nps_enet_send_frame':
>drivers/net/ethernet/ezchip/nps_enet.c:370:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

>but will also fail to work for other reasons.

>In this patch, I'm trying to change the code to use only normal kernel pointers, which I assume is what the author actually meant:

>* For reading or writing a 32-bit word that may be unaligned when
> an SKB contains unaligned data, I'm using get_unaligned/put_unaligned()
>  rather than memcpy_fromio/toio.

>* For converting a u8 pointer to a u32 pointer, I use a cast rather
>  than the incorrect virt_to_phys.

>* For copying a couple of bytes from one place to another while respecting
 > alignment, I use memcpy instead of memcpy_toio.

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

I have tested it on my simulator environment and driver compiles cleanly and runs happily without any problem.
Thank you.

Acked-by Noam Camus <noamc@ezchip.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: ezchip: fix address space confusion in nps_enet.c Arnd Bergmann <arnd@arndb.de> - 2015-12-08 16:30 +0100
  RE: [PATCH] net: ezchip: fix address space confusion in nps_enet.c Noam Camus <noamc@ezchip.com> - 2015-12-08 17:00 +0100
  Re: [PATCH] net: ezchip: fix address space confusion in nps_enet.c David Miller <davem@davemloft.net> - 2015-12-09 05:00 +0100

csiph-web