Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1349177lqt; Wed, 20 Mar 2024 00:32:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQFuti+DiOOdohwiyBdhNjDTdAYL4MGPP7auf/88UfZsL5pX5cNMK9cPQDm+caynoHjfZnn9LYrxJbb5Imr0qEsgtkCGqtejJK35UuXw== X-Google-Smtp-Source: AGHT+IGrjiT6s5g1t3ysNWFMiBDVQP/6HHMFKl/uxKR9NGhCIIT/8TbVQZFXrhrHaIzTfKTSJAc5 X-Received: by 2002:a05:6a20:bb27:b0:1a3:6a74:2e6a with SMTP id fc39-20020a056a20bb2700b001a36a742e6amr1117695pzb.14.1710919976244; Wed, 20 Mar 2024 00:32:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710919976; cv=pass; d=google.com; s=arc-20160816; b=n0NSrqVma3byvfQ1XLK1hVYBI4L1skVf+Md4cOjw7UwRRVodLNETOOgdEDA5dBZk8k UzVe+ysbzyxQx4MjRQWyWQCtCFcVd5G4ZmmxFzdrjJ4c/MFPZL+qWzaVuUBgo+cQPbIO VJkNfPKnUxk4eIvCTAj2zbWloNIGnAsJVHK648dJaxvO6VaVEEgCY2DnTKoWhFMlGJ78 vh0MX9rzY8i5ZbTtj2bvEypOG2B6xvr23zHP5OHD9ai//Bwy9I3fx2h4rIWy/mgUIs+8 0eudHvbB6q1h9nFxW/RIIbKfYIrZr8bzHLXl4NZYqNwbPf4T+lrg8WhvyheyrFhbcTgv u7xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=qzcBOQ9A2gjB2nXWLEneAyXAgJH2MzSNJvie31esoxU=; fh=VARDJTCeBHJa0JOokd+QwZl1nncxQYDignmbiZFFNB0=; b=ZFYuznCvFCaiiUvgggOOl0iw79UOA+U0+6lHPdq9scOykKaitHIK93VBg0O14X8oVD OWw3GDXIYN3OPHopAmpandoE1GKI7HYw4r0AX+tkhJj8GO6iOZU+Bl+znMz11S9dQwdn JMAwgKJx7kPODEA+ou8wbURGExaMPKU5CilYcVAgG7GG4ZQFSf1tFA+x1Mz9VahELn87 wGpbwihA6H7V/SI/41/yjbI9/oLOhkZqoHD91AYB2LDhm4D0RjsWjG1Nyt2bQ4Sk755Z JWMS7bXVtbLzF8J0skx7diZE/hS2zwp3E1+Ma5dMyQGFuDAEb4rUZRkyEWcxN+TpigQ8 mnYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=hvE5SlOa; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-108545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a13-20020aa7864d000000b006e68061bd6esi12592383pfo.184.2024.03.20.00.32.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 00:32:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=hvE5SlOa; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-108545-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5EA862831B0 for ; Wed, 20 Mar 2024 07:32:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8CA124A19; Wed, 20 Mar 2024 07:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="hvE5SlOa" Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) (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 05DEB210FE; Wed, 20 Mar 2024 07:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710919951; cv=none; b=aIK8bvyze5/fdjR8r7f3qQ8CSKFf7KMkQy0lxcJZ5ZQlJf0dXqDLI4yrLbum7ksE/5Pql0qAWlj26Yfffg2CRMzmuGgoS2asCAc4qVwAXp5LH3UKCEHgUd5lhptFrGk38lLv88WZU3Gga/YD8+ORfMDQpZD3xbFC9/5bURzhiYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710919951; c=relaxed/simple; bh=W352MWh4bC/sCGnq6hRHMpiRENfzvwFGb/Q+kSMC+Cs=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=fe4XVgy0eNqIB36lbwUh4vDDXLd4E7kRyNZnEQdq6Xn6DgTUZ5kADaJgCmjjtLUk5h/0sT+CfjSUkS3z2zcZvqQ7//EEGRvuW5LTDfKaKhdJJAewLom3oP4UchyrlVMkAOxYUhp7qppmzqICgNPiSwrrl2kzyNV7zoQzuuvqbb8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=hvE5SlOa; arc=none smtp.client-ip=192.134.164.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=qzcBOQ9A2gjB2nXWLEneAyXAgJH2MzSNJvie31esoxU=; b=hvE5SlOaaYtsnN0MQvi5uhuOIyDe8W3ACZt7Xy+mVsU0ATlOQNLPa2BJ bL5yAPtVv0Ru0aanmuHg7DuVoqohm8Fw3aEqNQSjKqTyZkJONR+6yfeRJ ionEiL2ncdyt87/84p3UwUr1tbbXr0ZssuoZq9LQbojhkPCb002PysCzG s=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.07,139,1708383600"; d="scan'208";a="82621728" Received: from dt-lawall.paris.inria.fr ([128.93.67.65]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 08:32:18 +0100 Date: Wed, 20 Mar 2024 08:32:17 +0100 (CET) From: Julia Lawall To: 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 In-Reply-To: Message-ID: 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 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) = NULL; > > > + void *mac_buf __free(kfree) = NULL; > > > > 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. My understanding from Jonathan Cameron was that Linus wants a NULL always, unless there is an initialization with the declaration. julia