Re: [PATCH 05/27] gpu: nova-core: zero-pad radix3 page table levels to page boundary

Timur Tabi <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, 2026-08-18 at 20:51 -0700, John Hubbard wrote:
> diff --git a/drivers/gpu/nova-core/firmware/radix3.rs b/drivers/gpu/nova-
> core/firmware/radix3.rs
> index b60611c7bea0..f14ad4e82d3d 100644
> --- a/drivers/gpu/nova-core/firmware/radix3.rs
> +++ b/drivers/gpu/nova-core/firmware/radix3.rs
> @@ -67,22 +67,18 @@ pub(crate) fn new<'a>(
>              Ok(try_pin_init!(Self {
>                  data <- SGTable::new(dev, data, DataDirection::ToDevice, GFP_KERNEL),
>                  level2 <- {
> -                    VVec::<u8>::with_capacity(
> -                        data.iter().count() * core::mem::size_of::<u64>(),
> -                        GFP_KERNEL,
> -                    )
> -                    .map_err(|_| ENOMEM)
> -                    .and_then(|level2| map_into_lvl(&data, level2))
> -                    .map(|level2| SGTable::new(dev, level2, DataDirection::ToDevice,
> GFP_KERNEL))?
> +                    let level2 = VVec::<u8>::with_capacity(lvl_size(&data), GFP_KERNEL)
> +                        .map_err(|_| ENOMEM)
> +                        .and_then(|level2| map_into_lvl(&data, level2))?;
> +
> +                    SGTable::new(dev, level2, DataDirection::ToDevice, GFP_KERNEL)

Could you use the new Vec::zeroed() to get a buffer that's already all zeroed-out?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.