Re: [PATCH v2] x86/boot/KASLR: Fix unused variable warning

From: Zhenzhong Duan
Date: Sun Jan 12 2020 - 21:44:06 EST


On Fri, Jan 10, 2020 at 5:00 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Fri, Jan 10, 2020 at 10:27:02AM +0800, Zhenzhong Duan wrote:
> > Yes. Will you send this formally?
>
> And then a flood of fix-this-trivial-warning patches ensues?
>
> You should know that they have the lowest prio when it comes to looking
> at them.
I see.
Just tried Arvind's patch, result is not that bad. Below are all
warnings during build:
In fact, only gop.c and kaslr.c have compile warning.

/root/kernel/drivers/firmware/efi/libstub/gop.c: In function âefi_setup_gopâ:
/root/kernel/drivers/firmware/efi/libstub/gop.c:174:18: warning:
âpixel_formatâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
setup_pixel_info(si, pixels_per_scan_line, pixel_info, pixel_format);
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:97:6: note:
âpixel_formatâ was declared here
int pixel_format;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:166:45: warning:
âfb_baseâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
ext_lfb_base = (u64)(unsigned long)fb_base >> 32;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:95:6: note: âfb_baseâ
was declared here
u64 fb_base;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:174:18: warning:
âpixels_per_scan_lineâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
setup_pixel_info(si, pixels_per_scan_line, pixel_info, pixel_format);
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:93:6: note:
âpixels_per_scan_lineâ was declared here
u32 pixels_per_scan_line;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:163:17: warning:
âheightâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
si->lfb_height = height;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:92:13: note: âheightâ
was declared here
u16 width, height;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:162:16: warning:
âwidthâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
si->lfb_width = width;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:92:6: note: âwidthâ
was declared here
u16 width, height;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:271:18: warning:
âpixel_formatâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
setup_pixel_info(si, pixels_per_scan_line, pixel_info, pixel_format);
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:194:6: note:
âpixel_formatâ was declared here
int pixel_format;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:263:45: warning:
âfb_baseâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
ext_lfb_base = (u64)(unsigned long)fb_base >> 32;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:192:6: note: âfb_baseâ
was declared here
u64 fb_base;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:271:18: warning:
âpixels_per_scan_lineâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
setup_pixel_info(si, pixels_per_scan_line, pixel_info, pixel_format);
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:190:6: note:
âpixels_per_scan_lineâ was declared here
u32 pixels_per_scan_line;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:260:17: warning:
âheightâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
si->lfb_height = height;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:189:13: note: âheightâ
was declared here
u16 width, height;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:259:16: warning:
âwidthâ may be used uninitialized in this function
[-Wmaybe-uninitialized]
si->lfb_width = width;
^
/root/kernel/drivers/firmware/efi/libstub/gop.c:189:6: note: âwidthâ
was declared here
u16 width, height;

/root/kernel/arch/x86/boot/compressed/kaslr.c: In function âprocess_mem_regionâ:
/root/kernel/arch/x86/boot/compressed/kaslr.c:698:6: warning: unused
variable âiâ [-Wunused-variable]
int i;

Regards
Zhenzhong