From: Tetsuya Mukawa Date: Mon, 16 Mar 2015 03:43:21 +0000 (+0900) Subject: null: fix dereference before null check X-Git-Tag: spdx-start~9414 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8d59064fb3c323f3fcc6441fc262d04611b794a0;p=dpdk.git null: fix dereference before null check This patch fixes potential null pointer access of eth_null_copy_tx(). Reported-by: John Mcnamara Signed-off-by: Tetsuya Mukawa --- diff --git a/lib/librte_pmd_null/rte_eth_null.c b/lib/librte_pmd_null/rte_eth_null.c index 8fe1a2d554..0e18502704 100644 --- a/lib/librte_pmd_null/rte_eth_null.c +++ b/lib/librte_pmd_null/rte_eth_null.c @@ -160,11 +160,12 @@ eth_null_copy_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) { int i; struct null_queue *h = q; - unsigned packet_size = h->internals->packet_size; + unsigned packet_size; if ((q == NULL) || (bufs == NULL)) return 0; + packet_size = h->internals->packet_size; for (i = 0; i < nb_bufs; i++) { rte_memcpy(h->dummy_packet, rte_pktmbuf_mtod(bufs[i], void *), packet_size);