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] [day] [month] [year] [list]
Message-ID: <Z9tCVIPTZr10WnNq@gmail.com>
Date: Wed, 19 Mar 2025 23:16:52 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Denis Mukhin <dmkhn@...ton.me>
Cc: dmukhin@...d.com, Jonathan Corbet <corbet@....net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>, linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] x86/early_printk: add MMIO-based UARTs


* Denis Mukhin <dmkhn@...ton.me> wrote:

> Hi,
> 
> Thanks for taking a look!
> 
> On Monday, March 17th, 2025 at 12:58 AM, Ingo Molnar <mingo@...nel.org> wrote:
> 
> >
> >
> >
> > * Denis Mukhin via B4 Relay devnull+dmukhin.ford.com@...nel.org wrote:
> >
> > > + if (!strncmp(s, "nocfg", 5))
> > > + baudrate = 0;
> > > + else {
> > > + baudrate = simple_strtoul(s, &e, 0);
> > > + if (baudrate == 0 || s == e)
> > > + baudrate = DEFAULT_BAUD;
> > > + }
> >
> >
> > In standard kernel coding style we always balance curly braces and
> > don't skip them in the single-statement case. Ie. the above should be:
> >
> > if (!strncmp(s, "nocfg", 5)) {
> > baudrate = 0;
> > } else {
> >
> > > + if (baudrate)
> > > + early_serial_hw_init(115200 / baudrate);
> >
> >
> > Hm, I think that division will go poorly if 'baudrate' ends up being 0
> > in the 'nocfg' case ... ;-)
> 
> This patch has a guardrail:
>   early_serial_hw_init(115200 / baudrate);
> will not be called in case of baudrate is 0.

Ugh, I must have had very limited reading comprehension that day :-/

> I can re-write code to avoid confusion.

No need to rewrite, the code is clear enough, it's my fault. :-)

But please do send -v3 with the curly braces fix, and merged against 
the latest x86 tree at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master

because there's a pending commit that creates a conflict:

  306859de59e5 ("x86/early_printk: Harden early_serial")

... while the conflict looks simple enough, it would be best to also 
test it, etc.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ