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 1C0FD43244; Mon, 30 Oct 2023 17:24:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98FB040285; Mon, 30 Oct 2023 17:24:16 +0100 (CET) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id D7FD640285 for ; Mon, 30 Oct 2023 17:24:14 +0100 (CET) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1cc394f4cdfso9956965ad.0 for ; Mon, 30 Oct 2023 09:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1698683054; x=1699287854; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=KVwFwMI0ahYZg1qrkAbB4mDigy9Jcs05BzobD6A3j+I=; b=d0/eloZGdmu1AiDth7rLEfL/y8WEfzJlFgUMhq+PQv6FZM7LAKBJIEtZ/Sxw/p3y5X vD9CojUBu02k5FSZLAB5FY9IcdXPXsIgNdT0f9HW5hneFQnnUnc4lIHILMW8Z+GEi1Sm Zoy4mBTOIL7GrBOWRu2IGseE94s8E/StPNUPtYseRezleeLNwYtW6VsYDQswAbhmm/Oi YT8+ooHmwLCUhTTEkwyOKHZvkSR9pdY+P/3KPKGVRtSCXp4h0QUvz69KKKb+2PBPEYm1 rtYrjcyWPO1ZtGpkeCSqo76obV/tW9Fst1TBrm/l5qxdKy4gl9sSYefCxNqqWjJj8O0G t12w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698683054; x=1699287854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KVwFwMI0ahYZg1qrkAbB4mDigy9Jcs05BzobD6A3j+I=; b=TO8yXrjU0Hhv5kaXpiCmrb9RdsBYL9HDTcfZKkVoZfoDe+DKeapj3Ia0imd0Am806Z kNXt4eJpqZOG2Bde7+Ps+ejHpmeJ+d+HtgT/IJdGMGmTuyv5ADHsXutqmPGm8XUsAfD5 szrCY7REpyA0NCYxP2ZM9YcrRVo3F8hpZWqdFqUXaCyMFgmC7cx0oUEiigCDuS3XuIl8 Lm4IOWQfbCkuSfWzelQ5w7iJwzVUbw3KBjXu0a2b0hWZ1oGwhBvCQ8wQlAoZEPuG2R8j 1+pa4dAi0x8biWoTgZHF64yCwLNcmWUrzlcC5ptDQAPGjejPfZ7/e5MncCe+6eYnuGQK gCfw== X-Gm-Message-State: AOJu0YzK+1XCfzFy/RdxxVErjDyJC6a3hGpV738vXIk+5MWwpIIAOELG 4gPGnEkAfjiJgerMVG7XEEP6bQ== X-Google-Smtp-Source: AGHT+IGptwYFNkUft/FvcF88oTL+XCpvYsDWS7h+vuk4HbX91Cd4MinJv1QLVZwt8KuYxk28KEgV5g== X-Received: by 2002:a17:902:f34d:b0:1ca:7086:f009 with SMTP id q13-20020a170902f34d00b001ca7086f009mr6415261ple.61.1698683053714; Mon, 30 Oct 2023 09:24:13 -0700 (PDT) Received: from fedora ([38.142.2.14]) by smtp.gmail.com with ESMTPSA id w19-20020a1709027b9300b001cc256ce1besm3154734pll.138.2023.10.30.09.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:24:13 -0700 (PDT) Date: Mon, 30 Oct 2023 09:24:06 -0700 From: Stephen Hemminger To: Weiguo Li Cc: dev@dpdk.org, stable@dpdk.org, Weiguo Li Subject: Re: [PATCH] devargs: fix derefrence before null test Message-ID: <20231030092406.29ebcafa@fedora> In-Reply-To: References: X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 30 Oct 2023 19:45:29 +0800 Weiguo Li wrote: > 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. */ NAK This patch is not necessary. Doing sizeof() on a NULL structure pointer is allowed. It is valid C.