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 DE588A0032; Thu, 12 May 2022 09:19:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCE0441145; Thu, 12 May 2022 09:19:53 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id E1350410FB for ; Thu, 12 May 2022 09:19:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652339991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VPJj6yLvfODwwVANzgKSLxFXDB7cM331gPGyHC3Srp4=; b=iyv76iOtQCe3Pi1Ixjm9PH3YwWF4CZe6mNmjm9g4ijj+5m+HMYRRjrZCEaCvAzNLelUNDU tY5aHEjgP8tBkD8UuHDUnjTXi909HRfQjwyumPgwrdpm/TXnTvo0nlDk2jfmb0Vm7ib3A4 p2C+zpVp9CFCIwp7JCuK8X3h8EUmStE= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-u3qkor5fNcS6oN-e5y7hVQ-1; Thu, 12 May 2022 03:19:48 -0400 X-MC-Unique: u3qkor5fNcS6oN-e5y7hVQ-1 Received: by mail-lj1-f197.google.com with SMTP id q7-20020a2e8747000000b0024f2d363986so1297836ljj.5 for ; Thu, 12 May 2022 00:19:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VPJj6yLvfODwwVANzgKSLxFXDB7cM331gPGyHC3Srp4=; b=vRT0tkW4so0WWOmVaUlgzCy/qoFTByBfXNNjt7pi9QXFuToidqznBLbc88MhNMYak2 ob7cQ7DH2dqKrV2Etq5byQ/AzVuG9DQ8RSka79TChpr4Z85AR0yWYjMjspxbpQerDuaF 4VlzjMywoVcLJsak/BuZE8Hghy6DVm+T3JE4vqftfCEMGM4LUedbg9GSnftULpMsWV5y /mfOAioLhV+t9/eaWqDWv1qtbVnLKfl54tUz16hQBFWzIAu7B7mzVtyHL7rFuzEGQPQP zsm2j5KfEZZ1fNBp14P89mt/RcRl2qe/a5SDmpvfKj+4VtsqUvCkwPKIuxSfcq/OVxwI SfnQ== X-Gm-Message-State: AOAM533vCjGvhddemsztEYk0+wYZMCQX1EgcLsR6E77CjZE1atfXbiWK INTfHgXsllZxbrc5To+dHIK0HCX2qzocnwjPIYFtqfpdDdugC+9ANXvFAwwgQm0xrW5MIYLIB8V sLNWgGOboESZZ8MnJiBY= X-Received: by 2002:a05:6512:2a92:b0:472:5c09:c1a8 with SMTP id dt18-20020a0565122a9200b004725c09c1a8mr22372197lfb.265.1652339986706; Thu, 12 May 2022 00:19:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3yo0ms0nRjZU0AZRSSAviOjkhlWKvZumddNWP8as/jS2Nc2VoycQS2+LEfttv/vk6RncADAq2JEO6WnUf9E4= X-Received: by 2002:a05:6512:2a92:b0:472:5c09:c1a8 with SMTP id dt18-20020a0565122a9200b004725c09c1a8mr22372187lfb.265.1652339986529; Thu, 12 May 2022 00:19:46 -0700 (PDT) MIME-Version: 1.0 References: <20220324161503.13047-1-david.marchand@redhat.com> <7495551.lvqk35OSZv@thomas> In-Reply-To: <7495551.lvqk35OSZv@thomas> From: David Marchand Date: Thu, 12 May 2022 09:19:35 +0200 Message-ID: Subject: Re: [PATCH] app/testpmd: remove useless pointer checks To: Thomas Monjalon Cc: dev , dpdk stable , Ori Kam , Xiaoyun Li , Aman Singh , Yuying Zhang , Ferruh Yigit , Wei Zhao Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 Tue, Mar 29, 2022 at 11:26 AM Thomas Monjalon wrote: > > 24/03/2022 17:15, David Marchand: > > Parameters to this static helper can't be NULL. > > str has already been dereferenced in caller. > > dst and size point to variable in stack. > > The same function is copy/pasted in several places. > Why simplifying only this one? because of its static nature? > > Shouldn't we make it a common function as other string helpers? Sorry, this thread fell through the cracks. The issue was raised by covscan: Error: REVERSE_INULL (CWE-476): dpdk-21.11/app/test-pmd/cmdline_flow.c:7705: deref_ptr: Directly dereferencing pointer "size". dpdk-21.11/app/test-pmd/cmdline_flow.c:7711: check_after_deref: Null-checking "size" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. # 7709| if ((src == NULL) || # 7710| (dst == NULL) || # 7711|-> (size == NULL) || # 7712| (*size == 0)) # 7713| return -1; As for the rest of the code, there might be more cleanups to do, as followups. -- David Marchand