Linux EFI development
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Ard Biesheuvel <ardb+git@google.com>
Cc: linux-efi@vger.kernel.org, kazuma-kondo@nec.com,
	Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH] efi/libstub: Cast away type warning in use of max()
Date: Thu, 28 Mar 2024 09:21:42 +0100	[thread overview]
Message-ID: <ZgUollgbjAkTR0CD@wunner.de> (raw)
In-Reply-To: <20240326101850.914032-2-ardb+git@google.com>

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)

?

  reply	other threads:[~2024-03-28  8:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 10:18 [PATCH] efi/libstub: Cast away type warning in use of max() Ard Biesheuvel
2024-03-28  8:21 ` Lukas Wunner [this message]
2024-03-28  9:13   ` Ard Biesheuvel
2024-03-28 13:38     ` Lukas Wunner
2024-03-28 13:57       ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZgUollgbjAkTR0CD@wunner.de \
    --to=lukas@wunner.de \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=kazuma-kondo@nec.com \
    --cc=linux-efi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox