From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34FA6C54E68 for ; Thu, 21 Mar 2024 03:29:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C558981EC1; Thu, 21 Mar 2024 03:29:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OTtmNqolU2ow; Thu, 21 Mar 2024 03:29:24 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2575581EAE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1710991764; bh=JH7eRe4CLXoM7ZMe4KQBz2hc/x0tXXFjT19GCfgRCdY=; h=Date:From:To:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=HCBaMRzpBcmSQ1gAW15qPvKvCfwSMwzv21+JITv12oXyngNWH5dokTv1n4FvsLdm0 ZyP4w8rHl4POIiDvD+BIOi+IudBY82/zK1l6bFjEkznXQn/NOsIqmPln2//hXpF3jn TsTxSgMRPf17vTvNURcgoiEMVylMap+fZDqQtIRyk3cBEpxdC99nMAKUUBDg4L9KUJ 8s2j36d4y+HTZc+HGHiWIwG7cOgAyOFEPAIdtP1/f6BYhDGb5swxdMR8VLTSIimI1E 5A24ChdU6AhDFE8swABO7xQ0wAjCw7nJsR6Aj+hvfq6oypjth0+y733zYYA0TMj4ak pcUFTXGvfodxA== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 2575581EAE; Thu, 21 Mar 2024 03:29:24 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id CB6D91BF955 for ; Thu, 21 Mar 2024 03:29:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B703D81EAE for ; Thu, 21 Mar 2024 03:29:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k_V0CgT66igq for ; Thu, 21 Mar 2024 03:29:21 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=kuba@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 1FEE081EA9 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1FEE081EA9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1FEE081EA9 for ; Thu, 21 Mar 2024 03:29:20 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A0F3860EC2; Thu, 21 Mar 2024 03:29:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A8CC433F1; Thu, 21 Mar 2024 03:29:17 +0000 (UTC) Date: Wed, 20 Mar 2024 20:29:16 -0700 From: Jakub Kicinski To: Dan Carpenter Message-ID: <20240320202916.2f2bda73@kernel.org> In-Reply-To: References: <77145930-e3df-4e77-a22d-04851cf3a426@moroto.mountain> <20240319124317.3c3f16cd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710991758; bh=AndrSsRlqw/W3pe2hOtcA+x3b9aKANapvXbBK9oocR0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OyeHGcVWPFs5jA4jqo37nPwn0hPr4JaN3Tk9M97jdrF1Ew6O1kaC8D7ZDTAE5Z403 GDPKM4sMWJUrachr1ZouLRAwbI1VUoef22cCmIzAJNN2bDXSg3VJI2lSqN6f8b3GdY iuvnuhitVAge5QJNdD46qatqfWY+7FQeyb+JiFT6fBfqatpoB+k2MKrmbGNP7PeN3y QnEea0YPBxvhRQUUy4Yqf2XCOFbXwo0NV/NGGf6uZ4JBDlgpmaunLjgXLCaF0bF1ba azYkWxrcD9eL9ImsxJT7eHcQwHE4Bvk1STDgkTmilGmDnFULbc4mZaMXW2pPP2Dn4z 76vwdGIAeT86w== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=OyeHGcVW Subject: Re: [Intel-wired-lan] [PATCH net] ice: Fix freeing uninitialized pointers X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maciej Fijalkowski , Przemek Kitszel , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , Tony Nguyen , netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Paolo Abeni , "David S. Miller" Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Wed, 20 Mar 2024 08:01:49 +0300 Dan Carpenter wrote: > > This is just trading one kind of bug for another, and the __free() > > magic is at a cost of readability. > > > > I think we should ban the use of __free() in all of networking, > > until / unless it cleanly handles the NULL init case. > > Free handles the NULL init case, it doesn't handle the uninitialized > case. I had previously argued that checkpatch should complain about > every __free() pointer if the declaration doesn't have an assignment. > > The = NULL assignment is unnecessary if the pointer is assigned to > something else before the first return, so this might cause "unused > assignment" warnings? I don't know if there are any tools which > complain about that in that situation. I think probably we should just > make that an exception and do the checkpatch thing because it's such a > simple rule to implement. What I was trying to say is that the __free() thing is supposed to prevent bugs, and it's not. Even if it was easy to write the matcher rule, if __free() needs a rule to double check its use - it's failing at making it easier to write correct code. In any case. This is a patch for Intel wired, I'll let Intel folks decide. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D2739455; Thu, 21 Mar 2024 03:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710991758; cv=none; b=fbZL4G4SBP0GQbkFihXcp9nkc8+rZt2NIn5tQNtnyFdin0WunSciK7pqvKFzLe7zC72osGflsdAc+SQnWxVOIyf7Tgm4GCIJb8RieQyU5GIxVVN4SyEjfqBCo7qBvMP49Xo77gZZsl4/7A51aRN8boqf1QngPnCkuiG8zlf3VRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710991758; c=relaxed/simple; bh=AndrSsRlqw/W3pe2hOtcA+x3b9aKANapvXbBK9oocR0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pXOY3lxNBmCdR77XfV1shtr6SDQxI/URKUHgHzEfe8ctpbJrKnS0ZYdPgKLfkMgtUSRO50BX7a3Cd3EowGSDlAmAh922AX3AXajMqn4xnHSX3gpp3N+9CFdp0Z5nNoL57aEFrF4O0RuVjfxMevDu676Yu7i4tksLpWjm2Jku88A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OyeHGcVW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OyeHGcVW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A8CC433F1; Thu, 21 Mar 2024 03:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710991758; bh=AndrSsRlqw/W3pe2hOtcA+x3b9aKANapvXbBK9oocR0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OyeHGcVWPFs5jA4jqo37nPwn0hPr4JaN3Tk9M97jdrF1Ew6O1kaC8D7ZDTAE5Z403 GDPKM4sMWJUrachr1ZouLRAwbI1VUoef22cCmIzAJNN2bDXSg3VJI2lSqN6f8b3GdY iuvnuhitVAge5QJNdD46qatqfWY+7FQeyb+JiFT6fBfqatpoB+k2MKrmbGNP7PeN3y QnEea0YPBxvhRQUUy4Yqf2XCOFbXwo0NV/NGGf6uZ4JBDlgpmaunLjgXLCaF0bF1ba azYkWxrcD9eL9ImsxJT7eHcQwHE4Bvk1STDgkTmilGmDnFULbc4mZaMXW2pPP2Dn4z 76vwdGIAeT86w== Date: Wed, 20 Mar 2024 20:29:16 -0700 From: Jakub Kicinski To: Dan Carpenter Cc: Maciej Fijalkowski , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Paolo Abeni , Przemek Kitszel , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers Message-ID: <20240320202916.2f2bda73@kernel.org> In-Reply-To: References: <77145930-e3df-4e77-a22d-04851cf3a426@moroto.mountain> <20240319124317.3c3f16cd@kernel.org> Precedence: bulk X-Mailing-List: kernel-janitors@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 20 Mar 2024 08:01:49 +0300 Dan Carpenter wrote: > > This is just trading one kind of bug for another, and the __free() > > magic is at a cost of readability. > > > > I think we should ban the use of __free() in all of networking, > > until / unless it cleanly handles the NULL init case. > > Free handles the NULL init case, it doesn't handle the uninitialized > case. I had previously argued that checkpatch should complain about > every __free() pointer if the declaration doesn't have an assignment. > > The = NULL assignment is unnecessary if the pointer is assigned to > something else before the first return, so this might cause "unused > assignment" warnings? I don't know if there are any tools which > complain about that in that situation. I think probably we should just > make that an exception and do the checkpatch thing because it's such a > simple rule to implement. What I was trying to say is that the __free() thing is supposed to prevent bugs, and it's not. Even if it was easy to write the matcher rule, if __free() needs a rule to double check its use - it's failing at making it easier to write correct code. In any case. This is a patch for Intel wired, I'll let Intel folks decide.