[dpdk-dev,1/3] net/af_packet: handle strdup() failures

Message ID 1495044215-16915-1-git-send-email-ciwillia@brocade.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Chas Williams May 17, 2017, 6:03 p.m. UTC
  Fixes: 1b93c2aa81b4 ("net/af_packet: add interface name to internals")

Signed-off-by: Chas Williams <ciwillia@brocade.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Ferruh Yigit May 23, 2017, 9:50 a.m. UTC | #1
On 5/17/2017 7:03 PM, Charles (Chas) Williams wrote:
> Fixes: 1b93c2aa81b4 ("net/af_packet: add interface name to internals")
> 
> Signed-off-by: Chas Williams <ciwillia@brocade.com>

Series applied to dpdk-next-net/master, thanks.

Except patch 2/3, it is removed from patchset.
  

Patch

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index a03966a..ce4dc07 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -630,6 +630,8 @@  rte_pmd_init_internals(struct rte_vdev_device *dev,
 		goto error_early;
 	}
 	(*internals)->if_name = strdup(pair->value);
+	if ((*internals)->if_name == NULL)
+		goto error_early;
 	(*internals)->if_index = ifr.ifr_ifindex;
 
 	if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {