From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B0C2343241 for ; Mon, 30 Oct 2023 12:46:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A258540DF5; Mon, 30 Oct 2023 12:46:12 +0100 (CET) Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by mails.dpdk.org (Postfix) with ESMTP id 8B7E240285; Mon, 30 Oct 2023 12:46:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1698666354; bh=09TGe/UHDWQZz7WW0TU9oNUmcnw30Vl8Wfua4BEyyu4=; h=From:To:Cc:Subject:Date; b=h2OATsCoBOK8SjpllNxDHvjlqYi5/i+puiwcBN/D1Mby1z37bEqWK6DKJlI4onDrT pumRjAjKWUeL3Ylt34HSemC/0Zcp+zZKuTN80TKw61ajLaBEOREwxVRyoqq1pBUHlC ZjEy+8kiwlmt6IQu2PCUnP8qnqfQM8dA8OPjALOA= Received: from liwg-V5320.. ([36.112.73.58]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id B5D2C4BE; Mon, 30 Oct 2023 19:45:29 +0800 X-QQ-mid: xmsmtpt1698666329tbhk482eh Message-ID: X-QQ-XMAILINFO: NjwfzuPTvt15zPz4MCYPTYbeB0lKoMUoQIJzUxubn5I4rWwV5kKsAD39kUl6Jm +LkFSKuJlsJv4+XRvA8wjNvI3yAPVgSCCNjZEXXxA0RQuO3SeNlLuWnEQt7letdSqYqyaMzvfCwK 4VCweRMVKlRUqO9ujsm2hYJMF+yorK3BBtiD1sByKWKcIz9rOlMImYmiWKOLWaHSdF8zI92RSTuN FXBPnDh6X5oIJTjNGn8ZTMheM43Hm0anGsjzWco1sOpMujt1jCMqmQ8KHkJvoJzllfosNug2i99S mldr297QksCX6ka1tNLHeHTCqwnJh9KPHcoLudz6kS0R46cBnQAa4yaUJBFAeKzJUq2U5OLs0227 lY0rsoEs2EBL5fEioAKBFJgTlR7Z0NChv66FBlHdVxixfl8Y7yj5cb0LnVKQnt8n0x6Oi3ctHBup gTndIUsTxFJQNEFOhiuYOgppmU8YP1vlwMD64+l7FJ8GxV06h2G9BhsdYoEf5Wx20FRo+FzL2vmH UZeEBwn0Xx4f71eFp9UtvfJqtfwFHwNniUUllG8ZF17CHGsyF0guRARXnqwgMxigEGR4zf4PrQ7p XU5aeHoc7gS8+ou03uB2c+IyD/zCLaEk4nREJUJX5pgjZ6Zr7rUU7+xyks8090fSXgKgTC8jI6aO TUy8nG98TNQKa+OjD1waAKZQ8P+BhOxU3zrNLB3hZu1EeG4XFcvTnvR69g6M2/ISztLORpmNvf6C DeTaBWro+HGpxz8QrTV8zLXAbdJUWRBe/qIxSMR8NyyXi+ddNgtk7jhNh2atslN5XvdRAyeSGasf pt5qlhRCLftwm9ElrXc8/va7ftBMvYpHJkviLUYq/hQMW4WATVIB9F7dPwxTFuqfx6/vU4dr2F8p cE2F4PKVvj5OM8TliCwxmTVZVsh0h7AV4Hc8g3Zna8m9pOUZNSxNZPhS1fu8ZyUySSHJJLrUt06h zQobGxVdbVHHQhldwz7SeO5kcahwuIi2x5fJ71TKXwEty3RdzLuwcxJvx39QyyqUTmjLVP3/7MFe AU5WpjAYs8ryx2PJwZCj1WhnquMSE= X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Weiguo Li To: dev@dpdk.org Cc: stable@dpdk.org, Weiguo Li Subject: [PATCH] devargs: fix derefrence before null test Date: Mon, 30 Oct 2023 19:45:29 +0800 X-OQ-MSGID: <20231030114529.1669787-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Pointer 'da' was dereferenced and then compared to NULL, reorder the code to keep the logic consistent. Fixes: 4969f5914c9e ("devargs: introduce new parsing helper") Cc: stable@dpdk.org Signed-off-by: Weiguo Li --- .mailmap | 2 +- lib/eal/common/eal_common_devargs.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index 3f5bab26a8..b4f0ae26b8 100644 --- a/.mailmap +++ b/.mailmap @@ -1500,7 +1500,7 @@ Waterman Cao Weichun Chen Wei Dai Weifeng Li -Weiguo Li +Weiguo Li Wei Huang Wei Hu Wei Hu (Xavier) diff --git a/lib/eal/common/eal_common_devargs.c b/lib/eal/common/eal_common_devargs.c index fb5d0a293b..8d6c3938eb 100644 --- a/lib/eal/common/eal_common_devargs.c +++ b/lib/eal/common/eal_common_devargs.c @@ -185,11 +185,13 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev) { struct rte_bus *bus = NULL; const char *devname; - const size_t maxlen = sizeof(da->name); size_t i; if (da == NULL) return -EINVAL; + + const size_t maxlen = sizeof(da->name); + memset(da, 0, sizeof(*da)); /* First parse according global device syntax. */ -- 2.34.1