* [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size
@ 2018-04-06 11:30 Pavan Nikhilesh
2018-04-06 11:50 ` Yang, Zhiyong
0 siblings, 1 reply; 3+ messages in thread
From: Pavan Nikhilesh @ 2018-04-06 11:30 UTC (permalink / raw)
To: jerin.jacob, ferruh.yigit, pascal.mazon, vipin.varghese, thomas
Cc: dev, Pavan Nikhilesh
Fix incorrect sizeof operation being used for getting mac addr size.
Found while compiling with arm64 clang.
drivers/net/tap/rte_eth_tap.c:1410:40: error: argument to 'sizeof' in
'memcpy' call is the same pointer type 'struct ether_addr *' as the
destination; expected 'struct ether_addr' or an explicit length
[-Werror,-Wsizeof-pointer-memaccess]
rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr));
~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
Fixes: bcab6c1d27fa ("net/tap: allow user MAC to be passed as args")
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
drivers/net/tap/rte_eth_tap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 3e4f7a8e8..6ed4a8a02 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1406,7 +1406,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name,
if (is_zero_ether_addr(mac_addr))
eth_random_addr((uint8_t *)&pmd->eth_addr);
else
- rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr));
+ rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr));
/* Immediately create the netdevice (this will create the 1st queue). */
/* rx queue */
--
2.17.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size
2018-04-06 11:30 [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size Pavan Nikhilesh
@ 2018-04-06 11:50 ` Yang, Zhiyong
2018-04-06 15:02 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Yang, Zhiyong @ 2018-04-06 11:50 UTC (permalink / raw)
To: Pavan Nikhilesh, jerin.jacob, Yigit, Ferruh, pascal.mazon,
Varghese, Vipin, thomas
Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh
> Sent: Friday, April 6, 2018 7:31 PM
> To: jerin.jacob@caviumnetworks.com; Yigit, Ferruh <ferruh.yigit@intel.com>;
> pascal.mazon@6wind.com; Varghese, Vipin <vipin.varghese@intel.com>;
> thomas@monjalon.net
> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size
>
> Fix incorrect sizeof operation being used for getting mac addr size.
>
> Found while compiling with arm64 clang.
> drivers/net/tap/rte_eth_tap.c:1410:40: error: argument to 'sizeof' in
> 'memcpy' call is the same pointer type 'struct ether_addr *' as the
> destination; expected 'struct ether_addr' or an explicit length
> [-Werror,-Wsizeof-pointer-memaccess]
> rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr));
> ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
>
> Fixes: bcab6c1d27fa ("net/tap: allow user MAC to be passed as args")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
Good catch!
Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size
2018-04-06 11:50 ` Yang, Zhiyong
@ 2018-04-06 15:02 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-04-06 15:02 UTC (permalink / raw)
To: Yang, Zhiyong, Pavan Nikhilesh, jerin.jacob, pascal.mazon,
Varghese, Vipin, thomas
Cc: dev
On 4/6/2018 12:50 PM, Yang, Zhiyong wrote:
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pavan Nikhilesh
>> Sent: Friday, April 6, 2018 7:31 PM
>> To: jerin.jacob@caviumnetworks.com; Yigit, Ferruh <ferruh.yigit@intel.com>;
>> pascal.mazon@6wind.com; Varghese, Vipin <vipin.varghese@intel.com>;
>> thomas@monjalon.net
>> Cc: dev@dpdk.org; Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
>> Subject: [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size
>>
>> Fix incorrect sizeof operation being used for getting mac addr size.
>>
>> Found while compiling with arm64 clang.
>> drivers/net/tap/rte_eth_tap.c:1410:40: error: argument to 'sizeof' in
>> 'memcpy' call is the same pointer type 'struct ether_addr *' as the
>> destination; expected 'struct ether_addr' or an explicit length
>> [-Werror,-Wsizeof-pointer-memaccess]
>> rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr));
>> ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
>>
>> Fixes: bcab6c1d27fa ("net/tap: allow user MAC to be passed as args")
>>
>> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Acked-by: Zhiyong Yang <zhiyong.yang@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-06 15:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06 11:30 [dpdk-dev] [PATCH] net/tap: fix memcpy with incorrect size Pavan Nikhilesh
2018-04-06 11:50 ` Yang, Zhiyong
2018-04-06 15:02 ` Ferruh Yigit
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).