x86/boot: Fix latent memory corruption with early_boot_opts_t
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 1 May 2019 17:14:03 +0000 (18:14 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 13 May 2019 09:35:38 +0000 (10:35 +0100)
commit30596213617fcf4dd7b71d244e16c8fc0acf456b
treeda39c5e312e173652c8559acf348fc8788c51b57
parentc1740dc20ae5ea74d9dfc101cb9d2c2ed437f8a6
x86/boot: Fix latent memory corruption with early_boot_opts_t

c/s ebb26b509f "xen/x86: make VGA support selectable" added an #ifdef
CONFIG_VIDEO into the middle the backing space for early_boot_opts_t,
but didn't adjust the structure definition in cmdline.c

This only functions correctly because the affected fields are at the end
of the structure, and cmdline.c doesn't write to them in this case.

To retain the slimming effect of compiling out CONFIG_VIDEO, adjust
cmdline.c with enough #ifdef-ary to make C's idea of the structure match
the declaration in asm.  This requires adding __maybe_unused annotations
to two helper functions.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/boot/cmdline.c
xen/arch/x86/boot/defs.h