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: <f7e66377-4616-4e3e-aa2d-ccd512411f21@kernel.org>
Date: Fri, 11 Apr 2025 08:25:55 -0500
From: Mario Limonciello <superm1@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Jean Delvare <jdelvare@...e.com>, Andi Shyti <andi.shyti@...nel.org>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 Jonathan Corbet <corbet@....net>,
 Mario Limonciello <mario.limonciello@....com>,
 Yazen Ghannam <yazen.ghannam@....com>, Thomas Gleixner <tglx@...utronix.de>,
 Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>,
 "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
 "H . Peter Anvin" <hpa@...or.com>,
 Shyam Sundar S K <Shyam-sundar.S-k@....com>,
 Hans de Goede <hdegoede@...hat.com>,
 "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>,
 "open list:I2C/SMBUS CONTROLLER DRIVERS FOR PC" <linux-i2c@...r.kernel.org>,
 "open list:AMD PMC DRIVER" <platform-driver-x86@...r.kernel.org>
Subject: Re: [PATCH v3 4/4] x86/CPU/AMD: Print the reason for the last reset



On 4/11/25 07:50, Borislav Petkov wrote:
> On Fri, Apr 11, 2025 at 07:12:24AM -0500, Mario Limonciello wrote:
>> The idea was to walk all the bits and pick the first one that has a string
>> associated with it.  I was finding that sometimes the reserved bits are set
>> which would get you a NULL pointer deref.
> 
> Uff, that needs a comment at least.
> 
> But you can write it a lot simpler instead:
> 
> 	for (i = 0; i <= ARRAY_SIZE(s5_reset_reason_txt); i++) {
> 		if (!(value & BIT(i)))
> 			continue;
> 
> 		if (s5_reset_reason_txt[i])
> 			break;
> 	}
> 
> Simple loop, simple statements and all easy. :-)
> 
>> Right; I was worried about that too but find_next_bit() will return the size
>> argument when it doesn't find anything.
>>
>> So that should be s5_reset_reason_txt[32] which has the "Unknown" string.
> 
> Yeah, that definitely needs a comment above it.
> 

Thanks; I'll take your simpler solution and leave a comment above the 
!(value & BIT(i)) check about skipping reserved bits.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ