Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2494819rda; Wed, 25 Oct 2023 04:39:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeG4Ye9HzmbSsYy96kIhOSX7lxaN1og+PPgkyPRcRtn+UP8BdcOqut4I/XWi8kgqqWLDHq X-Received: by 2002:a05:6808:90:b0:3af:d9ea:74b6 with SMTP id s16-20020a056808009000b003afd9ea74b6mr16361241oic.43.1698233993977; Wed, 25 Oct 2023 04:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698233993; cv=none; d=google.com; s=arc-20160816; b=VhyTWAwwhte7z5k6WtPA34B9U02LmLp23fzuix0Sj1MAcnHsqpdvYIe9MGVif/lnd5 hNVR8Snrx52b58HGXZFLfMdpThNM9a1uMivfjOTt+//d4Ez3y1NSUz6aUQl0ZX76ZYt9 Agb9EH2/HkPHSPKBUDSOlCn9umteCOG8s3oGRCJELbvlCxNUQf+wcqE9z3vIoZNP+Lb+ es5YCGsFzxiguLgRFJECUVY10KveDkM071UGFnNcBJef2UYNgw2ksl2w5DvXBHwl8rQJ Pj4OkbkXKDoH9GQZPCloSzjU9zJwTcrJ5Wf2lxK3wsLBhuXuCdmURMzO0qQlwlntfoNS 3q5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=k+ZentH0C6mAVhoNQir5R0FCDI0dOcUIaUM4TCO9vGs=; fh=vmKYK6tpxwjGko6Tx6xU+NtDyfkS7Pd/GGvqcYJ1H1s=; b=C2XEk1h2UrVeb1EW4gx5FBGj1wEb+R3YdtgcyQKW92qMLJKdzd8B3TG5HdF/c37yr7 KBqGewW9LBAqmQreLa5O7Lp3EwrnhPaHIVa6XUmUcoOdrWbvZjHgOYAl348kPWzqZWzi do0I3tZ/hbbWtjB+ebHbdbDPgwfG/LL5WppKI4imYUKeJw7Y0skYKBVquHCvipg5MqIL i+kcGqygEWoHS9iOF7j0qB0VNbdPjCx0HES3U3cpO9JvuT0Yf5rbs6l7QaHsLu4aCtcE v7wvZodF+7UbBfkgouFtV2d7cYZsJ+a+3cxCcpbtfQeO+a0HwgDFOIjB6SpuKiTJ/6RJ aZAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QRSokw9o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x3-20020a25ac83000000b00d9cac72ba96si10089550ybi.136.2023.10.25.04.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 04:39:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QRSokw9o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 1F32B801D990; Wed, 25 Oct 2023 04:39:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232695AbjJYLjd (ORCPT + 99 others); Wed, 25 Oct 2023 07:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbjJYLjc (ORCPT ); Wed, 25 Oct 2023 07:39:32 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996C3129; Wed, 25 Oct 2023 04:39:29 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1cac925732fso38316625ad.1; Wed, 25 Oct 2023 04:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698233969; x=1698838769; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=k+ZentH0C6mAVhoNQir5R0FCDI0dOcUIaUM4TCO9vGs=; b=QRSokw9oYGJ2tSkAVyGwq5WzCNU8z1GtPOQBaIl9QazJjOZhAY23PNW+LUFAD/t2mw pF/Ty+xLiMHx/nLDhVVNkbWcn379EZoIVfV/AIYiStuaeUgLnUKxw0nbbQW8LMD2A2Eb Qc3yQXv8l4v7nzry7imlVjFdQ2iZKNAe9ZN3oBxR0lW/oFeCiQCni/mcnELKzxHhODq+ OnGpUJWEZAmW0Rf1gVHtF5zXtGEuelUoNZgTM0NhLdGnQL4VMK6UA1Siwz+RQjlc085T zbQN8l+/n4QRz7qMHEJf1dsvnSNUXS37rgWJ/hFnB41myIYrN1wnD5OotuosmQzlmgIZ UptQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698233969; x=1698838769; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k+ZentH0C6mAVhoNQir5R0FCDI0dOcUIaUM4TCO9vGs=; b=Yk1KU0BVEJckuLcmPfdKV7uBaBHoJjGC/B6QJ8iyn6kBPGMkizc0DJVnjI0horTCOG B1iR1UHNB1DOn1sxKGplCxcSO9a4nO7ZJmG//VbnUA1zF3mlsGnQmoDP8SOIc1Kn7I/s ku/fGzc/8zxigHObbdpAlw/jJY6D22C9EwgGXrJW7Tdi5t1tC4Td13c0UQOfj4ujMcjx 29ciHcX52xc/mZJNCFLbjILfYk04TsLZG11VzwSqwo19vbyG421nm4KBgent9KccSPHX 4m2aAGpQ6ZNIvQf6jw3fVaQ+IZPkB5zRNqdQ+Ml9H4mB8PNE1+iWwKFHkI8neeor31lZ fiYg== X-Gm-Message-State: AOJu0YyoLtlnCM+sHcTergF9CKb7SBKCkxYJQQAInyzLkicDGm976T1o gcC8xeFWmNWg8tleh6VmBQM= X-Received: by 2002:a17:902:d482:b0:1ca:eccb:d58b with SMTP id c2-20020a170902d48200b001caeccbd58bmr9455006plg.23.1698233968887; Wed, 25 Oct 2023 04:39:28 -0700 (PDT) Received: from [192.168.1.13] ([117.243.111.63]) by smtp.gmail.com with ESMTPSA id u5-20020a17090282c500b001c7283d3089sm8981594plz.273.2023.10.25.04.39.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Oct 2023 04:39:28 -0700 (PDT) Message-ID: Date: Wed, 25 Oct 2023 17:09:21 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] amd/pds_core: core: No need for Null pointer check before kfree Content-Language: en-US To: Wojciech Drewek , shannon.nelson@amd.com, brett.creeley@amd.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231024182051.48513-1-bragathemanick0908@gmail.com> <74296600-6d91-4353-a9f6-fdb1ed724a59@intel.com> From: Bragatheswaran Manickavel In-Reply-To: <74296600-6d91-4353-a9f6-fdb1ed724a59@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 25 Oct 2023 04:39:51 -0700 (PDT) Thanks Shannon! On 25/10/23 14:52, Wojciech Drewek wrote: > > On 24.10.2023 20:20, Bragatheswaran Manickavel wrote: >> kfree()/vfree() internally perform NULL check on the >> pointer handed to it and take no action if it indeed is >> NULL. Hence there is no need for a pre-check of the memory >> pointer before handing it to kfree()/vfree(). >> >> Issue reported by ifnullfree.cocci Coccinelle semantic >> patch script. >> >> Signed-off-by: Bragatheswaran Manickavel >> --- > Thanks for the patch! > One nit, you're missing a target tag. It should be [PATCH net-next] since this not a fix IMO. > Reviewed-by: Wojciech Drewek Hi Wojciech, Will take care of this next time. Thanks! >> drivers/net/ethernet/amd/pds_core/core.c | 7 ++----- >> 1 file changed, 2 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c >> index 2a8643e167e1..0d2091e9eb28 100644 >> --- a/drivers/net/ethernet/amd/pds_core/core.c >> +++ b/drivers/net/ethernet/amd/pds_core/core.c >> @@ -152,11 +152,8 @@ void pdsc_qcq_free(struct pdsc *pdsc, struct pdsc_qcq *qcq) >> dma_free_coherent(dev, qcq->cq_size, >> qcq->cq_base, qcq->cq_base_pa); >> >> - if (qcq->cq.info) >> - vfree(qcq->cq.info); >> - >> - if (qcq->q.info) >> - vfree(qcq->q.info); >> + vfree(qcq->cq.info); >> + vfree(qcq->q.info); >> >> memset(qcq, 0, sizeof(*qcq)); >> }