lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whPZoi03ZwphxiW6cuWPtC3nyKYS8_BThgztCdgPWP1WA@mail.gmail.com>
Date: Tue, 18 Nov 2025 11:22:27 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Bart Van Assche <bvanassche@....org>, 
	James Bottomley <James.Bottomley@...senpartnership.com>, ksummit@...ts.linux.dev, 
	Dan Williams <dan.j.williams@...el.com>, linux-kernel <linux-kernel@...r.kernel.org>, 
	Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: Clarifying confusion of our variable placement rules caused by cleanup.h

On Tue, 18 Nov 2025 at 11:16, Steven Rostedt <rostedt@...dmis.org> wrote:
>
> I've been doing the above, and was even going to recommend it to James. But
> if it is preferred to declare the __free() variables where they are
> allocated, I'd be much happier.

I'm not going to make some hard rule that "it's preferred", but I
think it's simpler and clearer, and I would not want to discourage it.

That said, I *do* want to discourage the rash of mindless conversions.
I do think th is is a situation where people should pick the more
readable version when writing code, *not* a "let's convert existing
code that isn't being otherwise modified" situation.

And your example of

>        struct foo *var __free(kfree) = NULL;
>
>        if (ret < 0)
>                return -ERROR;
>
>        [ several more error exits ]
>
>        var = kmalloc(..);

is exactly where I do think that just moving the declaration down does
actually make code sufficiently better that it then outweighs the "now
you have the variable declarations in random places".

Because I really feel like the whole "__free(kfree) = NULL" thing
doesn't make sense on its own. It really only makes sense when paired
with the "kmalloc()". And _that_ is why they go together.

But again: I don't want to make this some kind of hard rule, and I
think it should be done judiciously and with taste, not some kind of
crazy conversion thing.

              Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ