Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1194135lqp; Fri, 22 Mar 2024 08:03:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWl23MIowie1OhSLKw4p9mZZOym6GpUaTyHjWx1pLzLTJmlVI17W6veQf10/L8Ze2bX7aGJGxlVvi/H5IyCRAxYUIwTjp91C3GADtOWfA== X-Google-Smtp-Source: AGHT+IFBWeq0TGnAL0MhSL2sbfIUIKaELnnYIR09l+fBlQQ+I6HWzzqytg/HnX6hl+LoieJiuORQ X-Received: by 2002:a17:906:81c8:b0:a47:3527:90c0 with SMTP id e8-20020a17090681c800b00a47352790c0mr11813ejx.14.1711119834828; Fri, 22 Mar 2024 08:03:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711119834; cv=pass; d=google.com; s=arc-20160816; b=nvBnuJ0Qd9BsULKbFtas/o+T/fKP4s5u7JRHTCz3tK/0r5fgRGuRRdAsMFmbkJzrPS Bkh5aBezTeEg/DKEoKoKN/mO11imdEG86JxNO4Tw36rnt2U12kL861ju/a+ozCOO7Bbf UWv3m8DSQ2dtPJnFXWVhCQ0bMjt5x9VOGq3Fqa7oM8jhyuxN+MTVXbkdV36pttcoTK6H EVB20viJx4gCC6WFL6N32XSogNxYpwQ4SMdrXoIxREbAX9Fq6BVxkYtm2uQutbteTqR+ zgfLJ+y38R3o7A/Eysf/EGhSZeZ1+u64F6cgAhLKqVEgJlh19ihMFNckF9lF7TpFTp9l KzVQ== 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=owkAnMBkUoxCLI7D2dOA/81nag9LNAHZCGU4v0LrBbQ=; fh=wc2sO6fOpG3ytIK8ytLITwgS2uiKKGy4ITJglW9vsYk=; b=gz77//BcOu4oKDAWcx+CfWxIWfjP5qP4YjkqzglhCY0K1yyvNzEc2WZTg/8GvU88df sWgA+Fetwhj5VVbvjzHvEubytNR/n0t7QFX9BK6TCYLRrmRmi1pxJxNTnODXMd0qov7h XY4mEvjDIPbB0/ZVSB/PvTftKzqbP3lv6g1AIB24c2/gSaQSzNDBURnBgznXhBZxijOZ O6nE6gJhFZgXttDgIkhDP1Yjf6BFFXu98LNadfKpykRCmHAZqJu+70vDRhiZj9jsb93R 0evijLALEkF7jAibckPLx6lLYiUWdKTc+/W0LOS5AzL0UrTnpIDB+4RAGIZz+yCHToZD q9Eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HsMClaxW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111672-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b7-20020a17090630c700b00a46dcdb0002si980442ejb.443.2024.03.22.08.03.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:03:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111672-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HsMClaxW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111672-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111672-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 60EAF1F23158 for ; Fri, 22 Mar 2024 15:03:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCB844DA13; Fri, 22 Mar 2024 15:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HsMClaxW" 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 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: 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 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 :(