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 B321DA0032 for ; Thu, 12 May 2022 09:19:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A40E94014F; Thu, 12 May 2022 09:19:51 +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 D84C741145 for ; Thu, 12 May 2022 09:19:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652339989; 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=IMDsPmYdD+awSgqEMPg+4wETPjUa/k43I79o2AknnMzI5AWTBA8U4+kGIxs4NncCdNEsop tbkAi7eyyB9zKoxogPcUFVA1diSs+kEICCrLoU3hEGGouADe2DJfT5z1Jm6MKvTxY6lAiI RJDlWHQKSmoz8TYpLpOpECIGPvAvBSY= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-MZwjhxUpPjqwJHbKeNipfw-1; Thu, 12 May 2022 03:19:48 -0400 X-MC-Unique: MZwjhxUpPjqwJHbKeNipfw-1 Received: by mail-lf1-f71.google.com with SMTP id h15-20020ac24daf000000b00472586ed83dso1812816lfe.22 for ; Thu, 12 May 2022 00:19:48 -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=FIMXahPSqldWdjSA3+DT5XoYI58DzZbgZz3KPp1OJCah2e+sGEH3k7MkthgUiHdYxI WUcsQ16FOu8bWBqBf/+MXHqHUkz06rvOyVEWSycepbnNy9eQ/s8vX+ScRF45eulzhiva KweA5+SItEbCMuHrHktzz5eMM/dd009ueayAm58VujZUm0Mf6pQQ87pMpCnh0XIDdDat DI55KqTiny1kr4OheKLRXxANth5dHF+gGvIQ2J5DIO5OQkqV+0ep86WdPzKcG1GEm0ie XTgBwIZKVHu8bKrSBEm01Ns9sQ7nub7JgI52XjuOf037Yw2RzXcMdlp0dZlbcKtmGeav 7lOA== X-Gm-Message-State: AOAM533/AJm64b4Wqfbhp+WvultQkV4R/zXAyazo/eOVlpXftLokAzih QsohAYewiMY2Csw2RCeRavhakzKWFil6khCc8m9gwbR2vzcLrwlDrYFA6u4Qz+zeubAzGRCwfED lTrQkbowKIezeEbOhr2Mspnc= X-Received: by 2002:a05:6512:2a92:b0:472:5c09:c1a8 with SMTP id dt18-20020a0565122a9200b004725c09c1a8mr22372206lfb.265.1652339986790; 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: 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 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