[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] common/initcall: Extern linker symbols with correct types.



On 18/10/13 08:51, Jan Beulich wrote:
>>>> On 17.10.13 at 19:03, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> 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

Very good point - I shall submit v2 in due course.

~Andrew

>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> CC: Keir Fraser <keir@xxxxxxx>
>> CC: Jan Beulich <JBeulich@xxxxxxxx>
>> ---
>>  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
>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.