Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1645709lqt; Wed, 20 Mar 2024 09:47:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWdY58bPlGkC4eqMjgPFvDMTqAUuIkPY/ItO3oR0TCvDxpyy+1zS7U3w3gUMKrf0GMB8X/LYBNLelPC+ltJY9QuxThCY9Dx/24SZANm+w== X-Google-Smtp-Source: AGHT+IErzZZiJ1MmZOc6mmq83e1YyIa/YOq0sMnPJMhN8ndx5Cd6oSnGwHMzITAhxpRfZO49UNwO X-Received: by 2002:a05:620a:29c8:b0:789:cfc3:1544 with SMTP id s8-20020a05620a29c800b00789cfc31544mr3024845qkp.5.1710953253432; Wed, 20 Mar 2024 09:47:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710953253; cv=pass; d=google.com; s=arc-20160816; b=jC6M3wfTnt8obIk+kCu7XeBnUgodYLe+x30kapYboI6P2n4T2H/1whkZrhTwoltduC QwiWmaM4ufBHy18B61yvi8/5lPd8hPfUC2uCdnpKuBvU1IxQ5L49UiqD+uv3Aw9hSq7T i8s7KQb64uPk2Xr1wh4yNpC9D+i2I+laW5heMd8VBaOKTQ3CwEs9xTYyL7rG1fqxFgDJ D9v8kiG8t1chwEzVFTVK4MUZi1PeV0BeXpjMa87iy26bVuYAK26s5iV3a9RNItFDpW4F pwfBwS1qfjpBOVdwUAkl1k8SEwwp5gqxVTdA+bwK5L1Yh2FgCcezV2m6VlN/xDiQGkJr dDgg== 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:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date; bh=HnoTVvqM/q4duhPt67O4dfckh1Xukoog1YlRLx4IDtk=; fh=0CLFAPBj/UnmxUS7QsfS7nidlrZq2xGAnfjxnkPXe1o=; b=fRWKv+nW0UcsbU1n/nLMNvAWRBzK8YvKXYijhq7C4QcdlBJuGz9qs2xtgG3nG9xBCV ly6amk9Aw4UlihdtxVMMYupJzwaEc6kzLiZt8CtNJd4uN+eFvHVvsA8XcHB7+495g2vR XSNu814C+AAaxabcnZJnZYqmVXwSQqv4axYlhs79foOOxyqQJVFzldkwCfo8UKOacobr 9+lyxys6OfIjpX/x8fTX0NdMAsh17ivrnPN2tAD6FLe8gQdpg71TadrzM0NtbKXvnI8c 0WV3SqpvEaiKlOMdWYwu/JKQWVZ/rU8p+Wk3jGir7v6/xQNtwoATwQ0Bhds41Do8gq9i r1wQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=jic23.retrosnub.co.uk); spf=pass (google.com: domain of linux-kernel+bounces-109185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109185-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id qs21-20020a05620a395500b0078a02492a81si7041875qkn.760.2024.03.20.09.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 09:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=jic23.retrosnub.co.uk); spf=pass (google.com: domain of linux-kernel+bounces-109185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109185-linux.lists.archive=gmail.com@vger.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 EBA541C213F9 for ; Wed, 20 Mar 2024 16:47:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CC8469E00; Wed, 20 Mar 2024 16:47:21 +0000 (UTC) Received: from mx2.mythic-beasts.com (mx2.mythic-beasts.com [46.235.227.24]) (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 7D64C187F; Wed, 20 Mar 2024 16:47:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.24 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710953240; cv=none; b=n6rdhA6rApr1gHPOZErXqu/xOXmq8JXaMPm4emyvMG376w3I82JakTgNHeHlUbYd2CUFT/U0PSHEArk2zVqCMk43Ymj8AUGsMpWwYzltqeNRqaw1eBxfmM/qjgVMp4jh1Ku6rMrCGHJLnqdxnz3qlGuSc5gXqPuwwEzXTIRnymU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710953240; c=relaxed/simple; bh=KB4S6lfaY4jS9DUXhlshuPyIa2efuohtTmYPcJtq7Ew=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=sPwo2cPnYNDSKFwNUoF3awNzsqU26V7RYGJkurI1laFuy7SDXD4TLj1z2HdrE8NG8pkG6pE5B++uaeYz/bMt+7fc0jj2265IC1Mr8ouF9u9t/F+74VN549rHrQtI7wPREJh/vAVlfTbwcsgUAhAwJGrgETJOcvgNpA9jfTEd690= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jic23.retrosnub.co.uk; spf=pass smtp.mailfrom=jic23.retrosnub.co.uk; arc=none smtp.client-ip=46.235.227.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jic23.retrosnub.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jic23.retrosnub.co.uk Received: by mailhub-hex-d.mythic-beasts.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rmyt8-00BNeD-Pz; Wed, 20 Mar 2024 16:34:18 +0000 Date: Wed, 20 Mar 2024 16:33:02 +0000 From: Jonathan Cameron To: Julia Lawall , Dan Carpenter CC: Jakub Kicinski , 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, Jonathan Cameron Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers User-Agent: K-9 Mail for Android In-Reply-To: References: <77145930-e3df-4e77-a22d-04851cf3a426@moroto.mountain> <20240319124317.3c3f16cd@kernel.org> Message-ID: <10F403F7-E8B7-48F0-90CF-3C8A8BEB10F2@jic23.retrosnub.co.uk> 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=utf-8 Content-Transfer-Encoding: quoted-printable X-BlackCat-Spam-Score: 0 On 20 March 2024 07:32:17 GMT, Julia Lawall wr= ote: > > >On Wed, 20 Mar 2024, Dan Carpenter wrote: > >> On Tue, Mar 19, 2024 at 12:43:17PM -0700, Jakub Kicinski wrote: >> > On Sat, 16 Mar 2024 12:44:40 +0300 Dan Carpenter wrote: >> > > - struct ice_aqc_get_phy_caps_data *pcaps __free(kfree); >> > > - void *mac_buf __free(kfree); >> > > + struct ice_aqc_get_phy_caps_data *pcaps __free(kfree) =3D NULL; >> > > + void *mac_buf __free(kfree) =3D NULL; >> > >> > This is just trading one kind of bug for another, and the __free() >> > magic is at a cost of readability=2E >> > >> > I think we should ban the use of __free() in all of networking, >> > until / unless it cleanly handles the NULL init case=2E >> >> Free handles the NULL init case, it doesn't handle the uninitialized >> case=2E I had previously argued that checkpatch should complain about >> every __free() pointer if the declaration doesn't have an assignment=2E >> >> The =3D 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=2E I think probably we should ju= st >> make that an exception and do the checkpatch thing because it's such a >> simple rule to implement=2E > >My understanding from Jonathan Cameron was that Linus wants a NULL always= , >unless there is an initialization with the declaration=2E I don't have thread to hand but Linus strongly preferred moving any declar= ation using this to where it is assigned so that it was obvious that the allocator and freer = match=2E Not checked if that makes sense here though=20 > >julia