Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp211869lqp; Wed, 20 Mar 2024 20:29:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJElXGd/p5k66os6pjbSBTPspzMVHydrf77ho/ddrVHNgp5GmHeKGDhYFUVFxCNsTAdWdpZhGzp/mMzv0XgWVM8tyKSQodFPmxdPSHIA== X-Google-Smtp-Source: AGHT+IHGbpEYT4m/P4+gwsuVG0BYxzluLEwyi5OLG0t8DEguIyRH4e9P/NQWYNNKx98VG/69lV4i X-Received: by 2002:a81:840a:0:b0:609:f353:d2ef with SMTP id u10-20020a81840a000000b00609f353d2efmr3992456ywf.38.1710991782029; Wed, 20 Mar 2024 20:29:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710991782; cv=pass; d=google.com; s=arc-20160816; b=DGqZ7ibqjvuvqikWe68uc4xwln6g5CpVd5XC9O7waTo85zIkmWtFiXaG5uqgRiHpUl o1KhExmlVsCr+A8bZtNcZ1YEL2JffDf22OH4xbsxZrxggEDlGNX9OU0KhTWP3nyWbY7/ l6YqqDQoDjwHtOUr553jRn9YaEX0vETuDUij3nNtIS3cc04chyvxky30lhEhI48MQDF8 MA13MG4NYcBXimx4AKpNFbMPJBTIrlkhhTmbaHacOxC3TY0CoRok0F8o6F/sLu75pPEx CqjGHd3Md52s7mlj2qhfaCIOz4Q98IaTjHQ2HWvxsl9LncDnbOeqcv4//3/y0QlJ8Jwn MWkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=JH7eRe4CLXoM7ZMe4KQBz2hc/x0tXXFjT19GCfgRCdY=; fh=ao35goAN9VhJViHJ98zGaIz56LAH0HFYL5AA02V8x7c=; b=wpQwYvLWgEUraMV9Jmz39uCFhPCgboOXr7aFDWhipWlobYaOXVP6uESkDcC9kA0KlD J19pjDokPEo1zNFgJs7S7pe7QlYjwYEMMhv4xHIcU8vk7xZHXjI99uM9ruSyQPtodVV+ JfxT1tqZuDT9SzWIiudktNLxALTykIifEtcC7kYXyT1Q5P+nE+x+tvfBcA6uiTFZRTSK mi5TadwZn+FDIT4sq95E+g0aB/bRamt9z0V/vTjh8fZ6AzVevvKTehabSAwjxTdWEHBZ aPh6XnbkCm3PufMmLc1q4WReyS0Ox7sxZW8qYU4ESlPp2KMfySR/vHpXpGq1MO9dx7nk Gp0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OyeHGcVW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id br25-20020a05622a1e1900b0042f21037f1esi6573130qtb.658.2024.03.20.20.29.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 20:29:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OyeHGcVW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B3D0B1C21723 for ; Thu, 21 Mar 2024 03:29:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D0FFBA45; Thu, 21 Mar 2024 03:29:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OyeHGcVW" 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 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: linux-kernel@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.