Thread (3 messages) 3 messages, 2 authors, 2025-11-06

RE: [Intel-wired-lan] [PATCH v2] net: ethernet: fix uninitialized pointers with free attr

From: Loktionov, Aleksandr <hidden>
Date: 2025-11-06 10:18:53
Also in: intel-wired-lan, linux-hyperv, lkml

-----Original Message-----
From: Intel-wired-lan <redacted> On Behalf
Of Ally Heev
Sent: Thursday, November 6, 2025 11:09 AM
To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
Przemyslaw [off-list ref]; Andrew Lunn
[off-list ref]; David S. Miller [off-list ref]; Eric
Dumazet [off-list ref]; Jakub Kicinski [off-list ref]; Paolo
Abeni [off-list ref]; K. Y. Srinivasan [off-list ref];
Haiyang Zhang [off-list ref]; Wei Liu [off-list ref];
Cui, Dexuan [off-list ref]
Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
kernel@vger.kernel.org; linux-hyperv@vger.kernel.org; Dan Carpenter
[off-list ref]; Ally Heev [off-list ref]
Subject: [Intel-wired-lan] [PATCH v2] net: ethernet: fix uninitialized
pointers with free attr

Uninitialized pointers with `__free` attribute can cause undefined
behaviour as the memory assigned(randomly) to the pointer is freed
automatically when the pointer goes out of scope

net/ethernet doesn't have any bugs related to this as of now, but it
is better to initialize and assign pointers with `__free` attr in one
statement to ensure proper scope-based cleanup

Reported-by: Dan Carpenter <redacted>
Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/ (local)
Signed-off-by: Ally Heev <redacted>
---
Changes in v2:
- fixed non pointer initialization to NULL
- NOTE: drop v1
- Link to v1: https://lore.kernel.org/r/20251105-aheev-uninitialized-
free-attr-net-ethernet-v1-1-f6ea84bbd750@gmail.com
---
...
Best regards,
--
Ally Heev [off-list ref]
Good day, Ally

Thanks for addressing the cleanup attribute initialization.
A few upstream‑style nits before this can go in:

Commit message:
  Use US spelling: behavior instead of behaviour.
  Expand abbreviations: replace attr with attribute.
  Drop speculative sentence: “net/ethernet doesn't have any bugs …” – not needed for a fix commit.
  Minor grammar: add a period before “net/ethernet”; remove parentheses in assigned(randomly).

Changelog:
  Hyphenate “non‑pointer” in “fixed non pointer initialization to NULL”.

Subject line:
net: ethernet: fix uninitialized pointers with __free attribute (spell out “attribute”).


Code style:
The new declaration + initializer is good, but please ensure both hunks stay within ~80 columns in drivers/net/*.
Wrapping like this is fine:

struct ice_flow_prof_params *params __free(kfree) =
        kzalloc(sizeof(*params), GFP_KERNEL);

No functional issues found; just these style and commit message cleanups.

Thanks,
Alex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help