From: Andrew Cooper Date: Mon, 28 Oct 2013 10:58:44 +0000 (+0100) Subject: common/initcall: extern linker symbols with correct types X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6126 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1c7964a1ea4b2f46958fdc716c7b9a06f5514fab;p=xen.git common/initcall: extern linker symbols with correct types Coverity IDs 1054956, 1054957 Coverity pointed out that we applying array operations based on an expression which yielded singleton pointers. The problem is actually that the externs were typed incorrectly. Correct the extern declaration to prevent straying into undefined behaviour, and relying on the lenience of GCC to work. Signed-off-by: Andrew Cooper Acked-by: Keir Fraser --- diff --git a/xen/common/kernel.c b/xen/common/kernel.c index b8707d90a1..4ca50c4d92 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -196,19 +196,20 @@ void add_taint(unsigned flag) tainted |= flag; } -extern initcall_t __initcall_start, __presmp_initcall_end, __initcall_end; +extern const initcall_t __initcall_start[], __presmp_initcall_end[], + __initcall_end[]; void __init do_presmp_initcalls(void) { - initcall_t *call; - for ( call = &__initcall_start; call < &__presmp_initcall_end; call++ ) + const initcall_t *call; + for ( call = __initcall_start; call < __presmp_initcall_end; call++ ) (*call)(); } void __init do_initcalls(void) { - initcall_t *call; - for ( call = &__presmp_initcall_end; call < &__initcall_end; call++ ) + const initcall_t *call; + for ( call = __presmp_initcall_end; call < __initcall_end; call++ ) (*call)(); }