From: "Jan Beulich" Subject: Re: [PATCH] common/initcall: Extern linker symbols with correct types. Date: Fri, 18 Oct 2013 08:51:05 +0100 Message-ID: <5261048902000078000FBFCA@nat28.tlf.novell.com> References: <1382029433-28919-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VX4qB-0002AZ-Cg for xen-devel@lists.xenproject.org; Fri, 18 Oct 2013 07:51:23 +0000 In-Reply-To: <1382029433-28919-1-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 17.10.13 at 19:03, Andrew Cooper wrote: > 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. Fine by me, but if you already touch this I would have really liked to see you also make the declarations const-correct. Jan > Signed-off-by: Andrew Cooper > CC: Keir Fraser > CC: Jan Beulich > --- > xen/common/kernel.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/xen/common/kernel.c b/xen/common/kernel.c > index b8707d9..e785edb 100644 > --- a/xen/common/kernel.c > +++ b/xen/common/kernel.c > @@ -196,19 +196,19 @@ void add_taint(unsigned flag) > tainted |= flag; > } > > -extern initcall_t __initcall_start, __presmp_initcall_end, __initcall_end; > +extern 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++ ) > + 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++ ) > + for ( call = __presmp_initcall_end; call < __initcall_end; call++ ) > (*call)(); > } > > -- > 1.7.10.4