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-=wh+h2WR6f2g+3HyLD1Zjg-fXC8yOE5bQmetrPvWHCU-2w@mail.gmail.com>
Date: Wed, 30 Jul 2025 16:15:21 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Masami Hiramatsu <mhiramat@...nel.org>, 
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Mark Rutland <mark.rutland@....com>, 
	Artem Sadovnikov <a.sadovnikov@...ras.ru>
Subject: Re: [GIT PULL] ftrace: Changes for v6.17

On Tue, 29 Jul 2025 at 11:42, Steven Rostedt <rostedt@...dmis.org> wrote:
>
>   In print_graph_proc() the pid_ptr string is of size 11, but the comment says
>   /* sign + log10(MAX_INT) + '\0' */ which is actually 12.

Lol. Quoting the ancient Greeks: "Math is hard, let's go shopping".

That said, the comment is garbage anyway.

Because "sign + log10(MAX_INT) + '\0'" really is just 11 - if you
round or truncate.

So somebody may have actually done the math "correctly", but the math
was just stated wrongly.

Much better to actually write things out properly instead of trying to be fancy.

Becasue might be more legible to actually write it out and let the
compiler do things, ie just do

   // This includes the sign and the terminating '\0'
   #define MAX_INT_CHARACTERS sizeof("-2147483648")

which doesn't require people to know - or think they know - logarithms.

Random rule for the day: don't ask people to do more than third-grade math.

         Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ