[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <726395fa54b40f117edc0a72285d28a70c156912.camel@gmail.com>
Date: Mon, 10 Nov 2025 12:26:24 +0530
From: ally heev <allyheev@...il.com>
To: Simon Horman <horms@...nel.org>, Alexander Lobakin
<aleksander.lobakin@...el.com>
Cc: Tony Nguyen <anthony.l.nguyen@...el.com>, Przemek Kitszel
<przemyslaw.kitszel@...el.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "K. Y.
Srinivasan" <kys@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>, Aleksandr
Loktionov <aleksandr.loktionov@...el.com>,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org, Dan Carpenter
<dan.carpenter@...aro.org>
Subject: Re: [Intel-wired-lan] [PATCH v3] net: ethernet: fix uninitialized
pointers with free attribute
On Sat, 2025-11-08 at 16:36 +0000, Simon Horman wrote:
[..]
> > Please don't do it that way. It's not C++ with RAII and
> > declare-where-you-use.
> > Just leave the variable declarations where they are, but initialize them
> > with `= NULL`.
> >
> > Variable declarations must be in one block and sorted from the longest
> > to the shortest.
> >
> > But most important, I'm not even sure how you could trigger an
> > "undefined behaviour" here. Both here and below the variable tagged with
> > `__free` is initialized right after the declaration block, before any
> > return. So how to trigger an UB here?
>
> FWIIW, I'd prefer if we sidestepped this discussion entirely
> by not using __free [1] in this driver.
>
> It seems to me that for both functions updated by this
> patch that can easily be achieved using an idiomatic
> goto label to free on error.
>
> [1] https://docs.kernel.org/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs
>
> ...
Understood. I will come-up with a new patch series for removing these
two instances
Regards,
Ally
Powered by blists - more mailing lists