Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4505251rwl; Wed, 28 Dec 2022 05:12:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzk2z3Z0yRhu7L1F8xzj4k9X4Z2dX1dcQIiuhF61400Aw6DbWlIDK85w/fwGSIS3hU+sZP X-Received: by 2002:a17:906:280d:b0:7c1:65f5:7b95 with SMTP id r13-20020a170906280d00b007c165f57b95mr21972128ejc.26.1672233144662; Wed, 28 Dec 2022 05:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672233144; cv=none; d=google.com; s=arc-20160816; b=cinKy4EGewrGsV6Wo7Gi2szMW5eWAn+YCwKfYyjycG8brhIHbfsNH+lWLslP4O1TDx iX8LJWuYiaiIKSQFX3AxNaJKrLI4Pf7DHWoayoZbJUCtEeTiHMlRJeTYiqTtJUNBfKeh bIp2pFm53qp0Cz/KPxc3faU1qPBY6/QEPSG/MfTPJ2nV8NgD6mblHDnfdIlIztjjgznL s/v+RCsS51ZQPhyfdSyKZZqCsM2WNs8KrftYQ6oouWzno0ioKJLl0Lerf5E65OQH+74U 1UVY9TE+GfCba8HW3RtEq25F0y1SOCJm7l/Y2U/0wXrET6KVJk0UYjympjK50nODPZys sRxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ru3PLI5wtnaHaLg3lUk7HAkMVl187HvEEtQIjloDcHw=; b=quEYfJzx30cbCQ0srASUF0DmKkQyxzxgx/YLH3TceGmmS0oNGXTdlaszpavqFwPXu0 F6zECF2Jgo7MseQta/gK2zS2Y0rMwT2y41FYUukNtm2MTrI2AyHItd1Bz8OvW8P6RthU yA8slslCBsqUHkyQ262D4uLHL39JXppBBgCC/og3tjHg/AsfXeyqc6kqGqzXDB3R0jBq WrbqxtLMGhgWt6R1Lor//zD7HdjOIJ5XhAaxkaEKBQnGa7yyJ6zK+ZNl2rWSbMON9Dhh n+qaOYFhuR4zOHva2sBrPIK1PP0B7YYrcwAtCZ6kJGylEh/BL5Xaicf+W1n/xEtvI3Od uQ3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=k0p8P+fH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd9-20020a1709069b8900b007877f3132d9si14720774ejc.438.2022.12.28.05.12.09; Wed, 28 Dec 2022 05:12:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=k0p8P+fH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbiL1NJO (ORCPT + 64 others); Wed, 28 Dec 2022 08:09:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiL1NJM (ORCPT ); Wed, 28 Dec 2022 08:09:12 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE95F73 for ; Wed, 28 Dec 2022 05:09:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1672232933; bh=XIsYijePFlvpwKLkAOrbvIzaHaw9+yquPSONaYDi1y4=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=k0p8P+fHJO/H/fobVSM9fo+LUmcVj4iuTvGn7MW/Mcck1I/Qrta04H+qRxUklHSIC wZM3jyhPAXlDgncIwdzkvpqkTAsROMFdzsAXcH00DgXoX4fDEs7X7oAdDR3blS98Ns NTV+M4gxxp36+lW3t0Pi/qm896okUQmH/YXnI+Ao= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 28 Dec 2022 14:08:53 +0100 (CET) X-EA-Auth: 51UmvQ9LL2ezogCcIPWdXZ5LqsEIzoMomGNKNMt1jBrzVDuAnIeVo85BDVyiHpfbe7DnVzrd88G7zCcex3Aj4j9XiPLbLFN6 Date: Wed, 28 Dec 2022 18:38:48 +0530 From: Deepak R Varma To: Mikko Perttunen Cc: Thierry Reding , David Airlie , Daniel Vetter , Jonathan Hunter , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: Re: [PATCH] drm/tegra: submit: No need for Null pointer check before kfree Message-ID: References: <864f2fdd-4289-a178-bbf1-c2a6a579c58c@kapsi.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <864f2fdd-4289-a178-bbf1-c2a6a579c58c@kapsi.fi> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 28, 2022 at 02:28:54PM +0200, Mikko Perttunen wrote: > On 12/27/22 19:14, Deepak R Varma 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: Deepak R Varma > > --- > > drivers/gpu/drm/tegra/submit.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/tegra/submit.c b/drivers/gpu/drm/tegra/submit.c > > index 066f88564169..06f836db99d0 100644 > > --- a/drivers/gpu/drm/tegra/submit.c > > +++ b/drivers/gpu/drm/tegra/submit.c > > @@ -680,8 +680,8 @@ int tegra_drm_ioctl_channel_submit(struct drm_device *drm, void *data, > > kfree(job_data->used_mappings); > > } > > > > - if (job_data) > > - kfree(job_data); > > + kfree(job_data); > > + > > put_bo: > > gather_bo_put(&bo->base); > > unlock: > > -- > > 2.34.1 > > > > > > > > It continues to be the case that I think this transform is bad. Same applies > to the host1x patch. Hello Mikko, Thank you for responding to the patch proposal. Could you please explain why is this bad? Regards, ./drv > > Mikko