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: <DBD3K8IK7UO5.2887TW6EM1CK5@nvidia.com>
Date: Wed, 16 Jul 2025 10:43:41 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Rhys Lloyd" <krakow20@...il.com>, <dakr@...nel.org>
Cc: <rust-for-linux@...r.kernel.org>, <airlied@...il.com>,
 <simona@...ll.ch>, <nouveau@...ts.freedesktop.org>,
 <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpu: nova-core: vbios: use size_of instead of magic
 number

On Mon Jul 14, 2025 at 7:43 PM JST, Rhys Lloyd wrote:
> 12 is identical to the value of `size_of::<BitHeader>()`,
> so use the latter instead.
>
> Signed-off-by: Rhys Lloyd <krakow20@...il.com>
> ---
>  drivers/gpu/nova-core/vbios.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
> index 663fc50e8b66..ac35415b4ffb 100644
> --- a/drivers/gpu/nova-core/vbios.rs
> +++ b/drivers/gpu/nova-core/vbios.rs
> @@ -365,7 +365,7 @@ struct BitHeader {
>  
>  impl BitHeader {
>      fn new(data: &[u8]) -> Result<Self> {
> -        if data.len() < 12 {
> +        if data.len() < core::mem::size_of::<Self>() {

I agree, but would feel better if we also made `BitHeader` `#[repr(C)]`
to really guarantee this.

(or please educate me if this is unneeded :))

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ