From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alec Brown Date: Fri, 7 Feb 2025 01:47:57 +0000 Subject: [PATCH] loader/i386/linux: Cast left shift to grub_uint32_t The Coverity complains that we might overflow into a negative value when setting linux_params.kernel_alignment to (1 << align). We can remedy this by casting it to grub_uint32_t. Fixes: CID 473876 Signed-off-by: Alec Brown Reviewed-by: Daniel Kiper --- grub-core/loader/i386/linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index c160ddb0e..b72b7d591 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -837,7 +837,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), GRUB_MEM_ATTR_R|GRUB_MEM_ATTR_W, GRUB_MEM_ATTR_X); linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; - linux_params.kernel_alignment = (1 << align); + linux_params.kernel_alignment = ((grub_uint32_t) 1 << align); linux_params.ps_mouse = linux_params.padding10 = 0; len = sizeof (linux_params) - sizeof (lh);