Re: [PATCH] efi/libstub: Cast away type warning in use of max()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Mar 2024 at 10:21, Lukas Wunner <lukas@xxxxxxxxx> wrote:
>
> On Tue, Mar 26, 2024 at 11:18:51AM +0100, Ard Biesheuvel wrote:
> > Add a missing (u64) cast to alloc_min, which is passed into
> > efi_random_alloc() as unsigned long, while efi_physical_addr_t is u64.
> [...]
> > --- a/drivers/firmware/efi/libstub/randomalloc.c
> > +++ b/drivers/firmware/efi/libstub/randomalloc.c
> > @@ -120,7 +120,7 @@ efi_status_t efi_random_alloc(unsigned long size,
> >                       continue;
> >               }
> >
> > -             target = round_up(max(md->phys_addr, alloc_min), align) + target_slot * align;
> > +             target = round_up(max(md->phys_addr, (u64)alloc_min), align) + target_slot * align;
>
> Why not
>
>     max_t(u64, md->phys_addr, alloc_min)
>

Why is that better?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux