* [PATCH] net: qlge: use memmove instead of skb_copy_to_linear_data
@ 2018-02-02 15:45 Arnd Bergmann
2018-02-03 0:46 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-02-02 15:45 UTC (permalink / raw)
To: Harish Patil, Manish Chopra, Dept-GELinuxNICDev
Cc: Arnd Bergmann, David S. Miller, Kees Cook, Johannes Berg, netdev,
linux-kernel
gcc-8 points out that the skb_copy_to_linear_data() argument points to
the skb itself, which makes it run into a problem with overlapping
memcpy arguments:
In file included from include/linux/ip.h:20,
from drivers/net/ethernet/qlogic/qlge/qlge_main.c:26:
drivers/net/ethernet/qlogic/qlge/qlge_main.c: In function 'ql_realign_skb':
include/linux/skbuff.h:3378:2: error: 'memcpy' source argument is the same as destination [-Werror=restrict]
memcpy(skb->data, from, len);
It's unclear to me what the best solution is, maybe it ought to use a
different helper that adjusts the skb data in a safe way. Simply using
memmove() here seems like the easiest workaround.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/qlogic/qlge/qlge_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 7b97a9969046..50038d946ced 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1747,8 +1747,7 @@ static void ql_realign_skb(struct sk_buff *skb, int len)
*/
skb->data -= QLGE_SB_PAD - NET_IP_ALIGN;
skb->tail -= QLGE_SB_PAD - NET_IP_ALIGN;
- skb_copy_to_linear_data(skb, temp_addr,
- (unsigned int)len);
+ memmove(skb->data, temp_addr, len);
}
/*
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: qlge: use memmove instead of skb_copy_to_linear_data
2018-02-02 15:45 [PATCH] net: qlge: use memmove instead of skb_copy_to_linear_data Arnd Bergmann
@ 2018-02-03 0:46 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-02-03 0:46 UTC (permalink / raw)
To: arnd
Cc: harish.patil, manish.chopra, Dept-GELinuxNICDev, keescook,
johannes.berg, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 2 Feb 2018 16:45:44 +0100
> gcc-8 points out that the skb_copy_to_linear_data() argument points to
> the skb itself, which makes it run into a problem with overlapping
> memcpy arguments:
>
> In file included from include/linux/ip.h:20,
> from drivers/net/ethernet/qlogic/qlge/qlge_main.c:26:
> drivers/net/ethernet/qlogic/qlge/qlge_main.c: In function 'ql_realign_skb':
> include/linux/skbuff.h:3378:2: error: 'memcpy' source argument is the same as destination [-Werror=restrict]
> memcpy(skb->data, from, len);
>
> It's unclear to me what the best solution is, maybe it ought to use a
> different helper that adjusts the skb data in a safe way. Simply using
> memmove() here seems like the easiest workaround.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This looks fine, applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-03 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 15:45 [PATCH] net: qlge: use memmove instead of skb_copy_to_linear_data Arnd Bergmann
2018-02-03 0:46 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).