Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1303918lqt; Tue, 19 Mar 2024 22:02:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+pE2DSEfB/tKw5O5ZfK+gzGpWqrAgBNRoqbBiQqy1V8jNva2FT1ZEqWexqHsgKKjkjT3zIDBYvbzEcPxI53pbNP6hlROPOrFsOqBobQ== X-Google-Smtp-Source: AGHT+IGC6pBr8bDbOPhjbVz7zVschuqXWsh2Yg1Q6gFneoQN1l7aCRhV5mriX9dr5EnoHLSRHCpM X-Received: by 2002:a05:6359:a3a4:b0:17e:8f90:dd31 with SMTP id ky36-20020a056359a3a400b0017e8f90dd31mr4335894rwc.32.1710910940893; Tue, 19 Mar 2024 22:02:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710910940; cv=pass; d=google.com; s=arc-20160816; b=LY0m7MIStWcUfmHIQNu3YEGAW8UHUcvQqb2F+hbVdBr//VtOtrd8Xlo3RCrXBCi7I8 uKHjKKPh3LrwLwKNWvQtSntqs75ql4+fu+Wptqxq/tp5fDqSUTyTMBRP0p4HSi2zz9xN n7/x0MsYAqm3Mmp2jExXVSgNlUn0NWwDpw7jKdw0mzvPhWRMSD3600AyfmekYYxiIrJy 6uIrvvxOJBuSzIiRC0S6d7j53eObprRSgLdBBawHZZrCI5b70+DrkMQIWh4Z6nUrBszs Jo1nSYxoJD25r5HQUZiZXqYf/rlOKyOBbZu3797SXI2HyKyndnIgfhODeK2OcBepPOnz 4Z+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=S0B7vWKH9/N5Rr83D0ntmMC2zkFMIdP3Ld+bd82Q6BI=; fh=0DqQ4n3nuFPHMQlulOLXkiqqAMs8qBYL642jJPNRaok=; b=gfw7kUr1az9Jw5+AoIYdgfO9fG3pIUEGGJzSCMb5HvRdp6ZaJuzvM2gh5tSJqf3WWt fjEqsSQ122bsxUgZ6LIag6TdJgDUi8EXbbtsnY2zaS5eDRbg79fdTz0UDz/gZdlg4k8m SZD11g9Vj0DUVe8WcxYSei28+TfS4J4wcAF5PD0M8upGHKgznd3bLV7OeSgAGX89E0wW W9beSRcyM2w/BTBpu7WRVQFB2nFJjkWudzNIht5sHh9yEB3HLBRIVRSU7TXSqk9UDsXO ikwTL+xi3+PMI4doP40lDPL6G+O48VYtqthsdFVjJM3hw/MWf4mUBWMsO6rgWku34fi2 QRRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c3+JZmgx; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-108437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108437-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k9-20020a63d849000000b005d8e283c1ebsi11595251pgj.840.2024.03.19.22.02.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 22:02:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c3+JZmgx; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-108437-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108437-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 750B7B21F05 for ; Wed, 20 Mar 2024 05:02:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D88D214287; Wed, 20 Mar 2024 05:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c3+JZmgx" Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 436F212E52 for ; Wed, 20 Mar 2024 05:01:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710910918; cv=none; b=jNyogYTNUuhvTMasNvWpxKGfTn0Ysa2exUFW2DbazTCMv2piWDtPQ29vhPmeV1mRwLvoru8J8mnptKiXoliVsNSsAUWf6F9pUeOiWruIj3GqQWj0HC7PNHcwgw04C5ys9LLOFgariBQKubnbLdSywqO5bKpnHxrLYWnflsj2nKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710910918; c=relaxed/simple; bh=OY1yJiqGKNtzEHd+k+wwWigcHefXcqgg1Yu1bcQ78IU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Wn0/cMZEZnTrXDO2V5qJdoL67avQkbrZUsCA/DO0292K6sBGHgBHH5AUbzls7FKB/Gl3yscFtIs3lbmiX19Eo/FJMYRpczFm2wW1jPZuwX+d8eDsQv7H8T1dVI0g8waYEZIqoN+T5tMpIu6U3bcVzW2gjLExx4hxCpz9agctVvg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=c3+JZmgx; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-414676fe047so9031035e9.2 for ; Tue, 19 Mar 2024 22:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710910914; x=1711515714; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=S0B7vWKH9/N5Rr83D0ntmMC2zkFMIdP3Ld+bd82Q6BI=; b=c3+JZmgxwOpNCkx47skUtLAwUXGnq6vf4ArrYKzGWhKlt3en5hwR53PjNQby5GVOJ9 BwYfmrS4CIygYv3hlFcUJzpNnTfXIc4vUi8srVQBpuGR6rJQPIHpaFarNYdsi9z96zfk 59pjkesvZXaqkJRhFA2wmRFOLkRxRoyZjr3Jxv+b0XeXr0DEaJTU9PzidsreC+yetJjG JAfM6d90M1AuTHnL98Ix7p2/VSlnaKfYwvRPLsYAeyyFtNQwICOOHNbVhDWBck8CdfgO rvoOHKU3M4/FA7NiDDbbatjWqzJ3yOKMtOaXdxDG2K3f8eCce6lNUcP6sEVeywJ9x2VC wuOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710910914; x=1711515714; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=S0B7vWKH9/N5Rr83D0ntmMC2zkFMIdP3Ld+bd82Q6BI=; b=qoajvC6oFIbFx7H1zq/ALHExERH7RNmLV1LrS3eaLAdueOZ+qtvI77S7nlWVzAakOG cWHJt68TU80uPMToz8nWFMoUgUWa7Q6Mw2lU5c8CHcUSrbjZGFQj3U8VTlg8eo3ieZAM C8Dt5l131PnuAeCoKDpnMYm2PDYpKgb90k2YPRimgP/9iDPH2yzbFtcOkMhl51RaxsMG x1E9+1raSuudDMIxYndqjWSo/OTqX5Q6aE8IFT35awqIswgJLyIswbgxqYXKf8hpuBj9 QnexsJckJEvodRUG/RArtJKlHXZwpuYd4oXbsZzSNbjliKHunWiqZEWgCl2RSMm+JRvm lQdA== X-Forwarded-Encrypted: i=1; AJvYcCU1eStZ2ShIimp8E++qfNM85lTQeqPGqC37OzY/D9l48wLXXs7b3l5FOeZZEligcTLgO71POow7O1lNyZ5QhdFXPM2yKvNPm7SbirBE X-Gm-Message-State: AOJu0YyW+Gs0Rqn1BEn7Mn+IIQdmjip+DyVA4I0hNEGP1y/CpIrf8crx NteKxwOH/3gQ2J6kEjwlaOyFCio025/Pv8VtKxh+ufj+/tA9bcUgtLbLtsgPIuI= X-Received: by 2002:a05:600c:3546:b0:414:ca1:6531 with SMTP id i6-20020a05600c354600b004140ca16531mr833716wmq.41.1710910914424; Tue, 19 Mar 2024 22:01:54 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id s14-20020a05600c45ce00b00414618bea7csm893210wmo.37.2024.03.19.22.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 22:01:53 -0700 (PDT) Date: Wed, 20 Mar 2024 08:01:49 +0300 From: Dan Carpenter To: Jakub Kicinski 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: 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-Disposition: inline In-Reply-To: <20240319124317.3c3f16cd@kernel.org> 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. regards, dan carpenter