]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpu: nova-core: vbios: use size_of instead of magic number
authorRhys Lloyd <krakow20@gmail.com>
Fri, 18 Jul 2025 07:36:24 +0000 (00:36 -0700)
committerAlexandre Courbot <acourbot@nvidia.com>
Tue, 12 Aug 2025 00:57:33 +0000 (09:57 +0900)
12 is identical to the value of `size_of::<BitHeader>()`, so use the
latter instead.

[acourbot@nvidia.com: remove `dead_code` expect to fix `unfulfilled_lint_expectations` lint]

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Rhys Lloyd <krakow20@gmail.com>
Link: https://lore.kernel.org/r/20250718073633.194032-2-krakow20@gmail.com
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
drivers/gpu/nova-core/vbios.rs

index 5b5d9f38cbb3a6b1c374c1e0eee2509eb8d5660c..b4bca1919d8f91412d8bd135cf1b602cc7753114 100644 (file)
@@ -345,7 +345,7 @@ impl PcirStruct {
 /// its header) is in the [`PciAtBiosImage`] and the falcon data it is pointing to is in the
 /// [`FwSecBiosImage`].
 #[derive(Debug, Clone, Copy)]
-#[expect(dead_code)]
+#[repr(C)]
 struct BitHeader {
     /// 0h: BIT Header Identifier (BMP=0x7FFF/BIT=0xB8FF)
     id: u16,
@@ -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>() {
             return Err(EINVAL);
         }