From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH 2/5] kni: fix possible uninitialized variable Date: Fri, 16 Nov 2018 17:58:51 +0100 Message-ID: <20181116165854.24017-3-thomas@monjalon.net> References: <20181116165854.24017-1-thomas@monjalon.net> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: stable@dpdk.org To: dev@dpdk.org Return-path: In-Reply-To: <20181116165854.24017-1-thomas@monjalon.net> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This error can be raised: lib/librte_kni/rte_kni.c:531:15: error: 'req' may be used uninitialized in this function It should not happen because kni_fifo_get() would return 0 if req is not initialized, so the function would return before using req. But GCC complains about it in -O1 optimization, and a NULL initialization is harmless here. Fixes: 3fc5ca2f6352 ("kni: initial import") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon --- lib/librte_kni/rte_kni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index c9726d4f8..73aeccccf 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -483,7 +483,7 @@ int rte_kni_handle_request(struct rte_kni *kni) { unsigned ret; - struct rte_kni_request *req; + struct rte_kni_request *req = NULL; if (kni == NULL) return -1; -- 2.19.0