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-=whYZVoEdfO1PmtbirPdBMTV9Nxt9f09CK0k6S+HJD3Zmg@mail.gmail.com>
Date: Sat, 11 Oct 2025 16:09:18 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>, Kees Cook <kees@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Masami Hiramatsu <mhiramat@...nel.org>, 
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [GIT PULL] tracing: A couple more fixes to v6.18

On Sat, 11 Oct 2025 at 12:52, Steven Rostedt <rostedt@...dmis.org> wrote:
>
> +       /* cnt includes both the entry->id and the data behind it. */
> +       size = struct_size(entry, buf, cnt - sizeof(entry->id));

This seems very non-intuitive.

Why isn't it just saying

    size = cnt + offsetof(struct raw_data_entry, id);

which would seem to be much more straightforward than saying "go to
the end, and then subtract out the size of this entry" - which then
relies on the entry being the last thing in the struct.

And if somebody wants to have a helper like

   #define struct_offset(s,memb) (offsetof(typeof(*(s)), memb))

in order to get some kind of "typesafe offsetof", to go with 'struct
size' then by all means.. That would make it be just

    size = cnt + struct_offset(entry, id);

which looks fairly legible and logical, and would go with the comment
(and would pair fairly well with our other "struct_xyz()" helpers, I
think).

I've pulled this, I just reacted to how odd that calculation looked.
It makes very little sense  to me, since the calculation really has
_nothing_ do with the size of the struct, and you explicitly have to
play tricks to get the offset that way.

         Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ