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 E24B9482E4; Fri, 22 Mar 2024 15:03:39 +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=1711119820; cv=none; b=fHEfA+o9g9YL6MHnxiH0+CMRuoEGGpIXRhO00Qg3a9HNg+6jgN7QQD58jeDeH2WU4ctK6OZQojhfqEaktbWo/MrUJU1Zi3cZuID/yCEXdUDCaaXrNaPUhyYX5gGvvy0kEgT6B0jsE1XdczahcvT1v716HIxDWh02lLXPzI6/Mwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711119820; c=relaxed/simple; bh=wLpygW9FYxva6ods0rOQA5KWZKfQ7KIT6Udekt7Xvzc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AtNdujTpJP7Q4eFOp+OdRtzGSfQXCYah33qkT8ncN8sNtitqNTWyX+3Ju4X69jRyMRrKmo29LZE9eWjlCtiK2foQzYgFXvelUMtNd62HS4WN2AYeKc40Lm2YkbU72j7ShsrSW5LaIJvoANVlHHV37H2fqBRbdz2it0P/ykhw7YM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HsMClaxW; 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="HsMClaxW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 677EEC433C7; Fri, 22 Mar 2024 15:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711119819; bh=wLpygW9FYxva6ods0rOQA5KWZKfQ7KIT6Udekt7Xvzc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HsMClaxWIL79OYvoZ8cCAZo3NCiLqVUVbM8EsiW5QpNgi93yEvJawTHzns5ULfJCO n00xPAvdfP0vMk06wppenLie8WV1EIjMZueUVspAQwVEmI/p2+aA3KDQK1DUESxRaW 1acKFSnQkigbvo4uCcwwFDlVPgBW7lZzMB4r0dLyKweS5jummg5uz+yUlwrXwf05ba bfd6ZO/dqMDWuKkXAUs209wP8DGJflrkBVylnANK/kTyBSK4eyPaKmoKxVbCor5lDs EPK2D8hNL7Qu/eF2buvDTZ13shSleFGNj79wORHDYxPPTtkgXskAfoagKcoA6d9A33 WlEuxdWcIUeMQ== Date: Fri, 22 Mar 2024 08:03:37 -0700 From: Jakub Kicinski To: Julia Lawall Cc: Jesse Brandeburg , Andy Shevchenko , Dan Carpenter , kernel-janitors@vger.kernel.org, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Maciej Fijalkowski , Przemek Kitszel , Tony Nguyen , LKML , Alexander Lobakin , David Laight , "David S. Miller" , Eric Dumazet , Jiri Pirko , Jonathan Cameron , Kees Cook , Lukasz Czapnik , Paolo Abeni , Pucha Himasekhar Reddy , Dan Williams Subject: Re: [PATCH net] ice: Fix freeing uninitialized pointers Message-ID: <20240322080337.77a10cfd@kernel.org> In-Reply-To: <82b49991-eb5a-7e8c-67e0-b0fd932f40b4@inria.fr> References: <20240321184828.3e22c698@kernel.org> <82b49991-eb5a-7e8c-67e0-b0fd932f40b4@inria.fr> Precedence: bulk X-Mailing-List: netdev@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 On Fri, 22 Mar 2024 03:24:56 -0400 (EDT) Julia Lawall wrote: > > At present I find this construct unreadable. > > I may get used to it, hard to say. > > > > Also I don't see the benefit of the auto-freeing construct, > > I'd venture a guess that all the bugs it may prevent would > > have been caught by smatch. But I'm an old curmudgeon stuck > > in my ways. Feel free to experiment in Intel drivers, and we'll > > see how it works out =F0=9F=A4=B7=EF=B8=8F =20 >=20 > In my experiments with of_node_put, there seem to be many functions where > removing the frees makes the function much more readable. But > kmalloc/kfree may be used in different contexts, where the management of > the memory is a smaller percentage of the overall code. So the tradeoffs > may be different. Good point! References are likely a very good use case for this sort of thing. The act of bumping a counter lacks the feeling of lifetime we get with an object :(