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

Zhenzhong Duan
2020-01-13T02:43:31Z

On Fri, Jan 10, 2020 at 5:00 PM Borislav Petkov <bp@alien8.de> 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