From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id E54D6591A for ; Thu, 27 Aug 2015 20:00:11 +0200 (CEST) Received: from uucp by smtp.tuxdriver.com with local-rmail (Exim 4.63) (envelope-from ) id 1ZV1T8-0007V1-7C; Thu, 27 Aug 2015 14:00:10 -0400 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.15.1/8.14.6) with ESMTP id t7RHopWj011817; Thu, 27 Aug 2015 13:50:51 -0400 Received: (from linville@localhost) by localhost.localdomain (8.15.1/8.15.1/Submit) id t7RHopBW011812; Thu, 27 Aug 2015 13:50:51 -0400 X-Authentication-Warning: localhost.localdomain: linville set sender to linville@tuxdriver.com using -f From: "John W. Linville" To: dev@dpdk.org Date: Thu, 27 Aug 2015 13:50:50 -0400 Message-Id: <1440697850-11763-1-git-send-email-linville@tuxdriver.com> X-Mailer: git-send-email 2.4.3 Subject: [dpdk-dev] [PATCH] rte_eth_af_packet: check return value from sendto call X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2015 18:00:12 -0000 Coverity CID # 13200 If sendto fails, the packets will not get transmitted. Return 0 as the number of packets transmitted. Signed-off-by: John W. Linville --- drivers/net/af_packet/rte_eth_af_packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index cac26e533813..bfde66115708 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -220,7 +220,8 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } /* kick-off transmits */ - sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0); + if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1) + return 0; /* error sending -- no packets transmitted */ pkt_q->framenum = framenum; pkt_q->tx_pkts += num_tx; -- 2.4.3