Separating the header allows the use of `size_of::()`
instead of the magic number 4.
Signed-off-by: Rhys Lloyd
---
drivers/gpu/nova-core/vbios.rs | 56 +-
1 file changed, 35 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu
Instead of the data field containing a u32 and changing the alignment,
change data to [u8; 4] and convert to u32 with a helper function.
Removes another magic number by making the struct the same size as
the data it needs to read, allowing the use of
`size_of::()`
Signed-off-by: Rhys Lloyd
12 is identical to the value of `size_of::()`,
so use the latter instead.
Signed-off-by: Rhys Lloyd
---
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
Instead of the data field containing a u32 and changing the alignment,
change data to [u8; 4] and convert to u32 with a helper function.
Removes another magic number by making the struct the same size as
the data it needs to read, allowing the use of
`size_of::()`
Signed-off-by: Rhys Lloyd
Introduce an associated constant `MIN_LEN` for each struct that checks
the length of the input data in its constructor against a magic number.
Signed-off-by: Rhys Lloyd
---
Changes in v2:
- Add commit description
- Fix author to match SoB
- Add base commit
---
drivers/gpu/nova-core/vbios.rs
data is sliced from 2..6, but the bounds check data.len() < 5
does not satisfy those bounds.
Fixes: 47c4846e4319 ("gpu: nova-core: vbios: Add support for FWSEC ucode
extraction")
Signed-off-by: Rhys Lloyd
---
Changes in v2:
- Ensure commit description does not spill into commit
On 7/13/25 8:11 PM, Alexandre Courbot wrote:
On Sun Jul 13, 2025 at 11:51 AM JST, Rhys Lloyd wrote:
Introduce an associated constant `MIN_LEN` for each struct that checks
the length of the input data in its constructor against a magic number.
Signed-off-by: Rhys Lloyd
As I mentioned in [1
Annotate the PmuLookupTableEntry with an `#[repr(C, packed)]` attribute.
Removes another magic number by making the struct the same size as
the data it needs to read, allowing the use of
`size_of::()`
Signed-off-by: Rhys Lloyd
---
Changes in v2:
- get_data helper function renamed to data
Changes
12 is identical to the value of `size_of::()`,
so use the latter instead.
Signed-off-by: Rhys Lloyd
---
Changes in v2:
- Added `#[repr(C)]` to `BitHeader`
---
drivers/gpu/nova-core/vbios.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b
Use the offset_of macro for each struct field, annotate the
`PmuLookupTableHeader` struct with `#[repr(C)]` attribute,
and add a TODO message to use FromBytes when available.
Signed-off-by: Rhys Lloyd
---
drivers/gpu/nova-core/vbios.rs | 10 ++
1 file changed, 6 insertions(+), 4
On Fri, Jul 25, 2025 at 7:04 AM Danilo Krummrich wrote:
>
> On 7/25/25 3:35 PM, Alexandre Courbot wrote:
> > This chunk does not apply - on nova-next PmuLookupTableHeader does not
> > seem to exist. I think I remember you split PmuLookupTableHeader in
> > another patch, so can you send all the rel
Separating the header allows the use of `size_of::()`
instead of the magic number 4.
Signed-off-by: Rhys Lloyd
---
drivers/gpu/nova-core/vbios.rs | 56 +-
1 file changed, 35 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu
Use the offset_of macro for each struct field, annotate the
`PmuLookupTableHeader` struct with `#[repr(C)]` attribute,
and add a TODO message to use FromBytes when available.
Signed-off-by: Rhys Lloyd
---
drivers/gpu/nova-core/vbios.rs | 10 ++
1 file changed, 6 insertions(+), 4
13 matches
Mail list logo