From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A00F1A0487 for ; Tue, 2 Jul 2019 13:46:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E9381B946; Tue, 2 Jul 2019 13:46:25 +0200 (CEST) Received: from mail-ua1-f67.google.com (mail-ua1-f67.google.com [209.85.222.67]) by dpdk.org (Postfix) with ESMTP id 525781B946 for ; Tue, 2 Jul 2019 13:46:24 +0200 (CEST) Received: by mail-ua1-f67.google.com with SMTP id v18so174135uad.12 for ; Tue, 02 Jul 2019 04:46:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tNO3O1vcZrVZiax+J5F2bFLfBV7EJbiwqG8xg7pD+JQ=; b=ZWth+P+gf5H4dgHjetxqK/cfxqy0oVfcWaqRH42ATRk4aMcMmNPEyFy7j/wUhSdLJA sH7ZqzEYv9gLjomX6OcIDdhNXZHjucd+gCb75QBxnn9QT0urgd05qeAZIQDnFdz7aJ+B 3J2ThUslu76vjKGoPxoORqMovu9U/HL4dgPr5Ux6ayRxGxy0503h58lwLfUfUsrIHNZW lDUb5NdZNlrImCPw3ntUfAE08CoDel++2KibUv3vdeWW7bHseZ3+UK+Hg6CNbrd4YeZs zOYb02KXERmslyJWq9fnq+PupOnFM4l6BJ7Hgii6bUTwGimYBPtePhetQ59Fpc4VXWkw y87g== X-Gm-Message-State: APjAAAWOxwL90mKgOzewPCg6oP0Lm8uX4910Q6L3Xo0gwRwm7mkgQdx5 vHv1j88d34EM145p9FEniR/wwpNv3lOhSo4LSHNfxQ== X-Google-Smtp-Source: APXvYqwJHfVJK8G0q9EqVHUWRKDe8tMXV8akNAUH59zzh80Kd5mD5gNn6kqrzDTVjVLndVtNCJX/Xx6YQ1VJaVKJbMU= X-Received: by 2002:ab0:2bc6:: with SMTP id s6mr17005234uar.86.1562067983741; Tue, 02 Jul 2019 04:46:23 -0700 (PDT) MIME-Version: 1.0 References: <1562066494-25411-1-git-send-email-jananeex.m.parthasarathy@intel.com> In-Reply-To: <1562066494-25411-1-git-send-email-jananeex.m.parthasarathy@intel.com> From: David Marchand Date: Tue, 2 Jul 2019 13:46:12 +0200 Message-ID: To: Jananee Parthasarathy Cc: dev , "Pattan, Reshma" , Cristian Dumitrescu , "Singh, Jasvinder" , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [PATCH] lib/table: fix table autotest ut crashes in ipv6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Jul 2, 2019 at 1:22 PM Jananee Parthasarathy < jananeex.m.parthasarathy@intel.com> wrote: > Unit test table_autotest results in segmentation fault. > Crash occurs in test_table_lpm_ipv6_combined(). > > Variable 'nht_pos0' used as array subscript is not initialized > in rte_table_lpm_ipv6_entry_add(). It will not be assigned, > if a rule does not exist. > > In such case a junk number or invalid array index might result in > segmentation fault due to array out of bounds when > lpm->nht_users is used with such invalid array index. > > Fix is to initialize the variables used for array subscript. > > Bugzilla ID: 285 Fixes: d89a5bce1d ("lpm6: extend next hop field") > Cc: stable@dpdk.org > > Signed-off-by: Jananee Parthasarathy > --- > lib/librte_table/rte_table_lpm_ipv6.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/librte_table/rte_table_lpm_ipv6.c > b/lib/librte_table/rte_table_lpm_ipv6.c > index a55f808a4..4e068d79b 100644 > --- a/lib/librte_table/rte_table_lpm_ipv6.c > +++ b/lib/librte_table/rte_table_lpm_ipv6.c > @@ -182,7 +182,7 @@ rte_table_lpm_ipv6_entry_add( > struct rte_table_lpm_ipv6 *lpm = table; > struct rte_table_lpm_ipv6_key *ip_prefix = > key; > - uint32_t nht_pos, nht_pos0, nht_pos0_valid; > + uint32_t nht_pos = 0, nht_pos0 = 0, nht_pos0_valid = 0; > nht_pos_valid is unconditionnally set, no need to initialize. Just noticed that nht_pos is not initialised to 0 in ipv4 code. It fixes the segfault I saw, leaving the ack to the maintainer. Tested-by: David Marchand -- David Marchand