Re: [PATCH v2 4/5] kmemleak: fix sparse warning over overshadowed flags

From: Luis R. Rodriguez
Date: Thu Sep 03 2009 - 14:05:33 EST


On Thu, Sep 3, 2009 at 9:55 AM, Catalin Marinas<catalin.marinas@xxxxxxx> wrote:
> On Thu, 2009-09-03 at 01:35 -0400, Luis R. Rodriguez wrote:
>> This fixes this sparse warning:
>> mm/kmemleak.c:512:31: warning: symbol 'flags' shadows an earlier one
>> mm/kmemleak.c:448:23: originally declared here
>>
>> Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx>
>> ---
>> Âmm/kmemleak.c | Â Â6 +++---
>> Â1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
>> index 58c07b1..24e7a84 100644
>> --- a/mm/kmemleak.c
>> +++ b/mm/kmemleak.c
>> @@ -509,14 +509,14 @@ static void create_object(unsigned long ptr, size_t size, int min_count,
>> Â Â Â Â* random memory blocks.
>> Â Â Â Â*/
>> Â Â Â if (node != &object->tree_node) {
>> - Â Â Â Â Â Â unsigned long flags;
>> + Â Â Â Â Â Â unsigned long flags_object;
>>
>> Â Â Â Â Â Â Â kmemleak_stop("Cannot insert 0x%lx into the object search tree "
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â "(already existing)\n", ptr);
>> Â Â Â Â Â Â Â object = lookup_object(ptr, 1);
>> - Â Â Â Â Â Â spin_lock_irqsave(&object->lock, flags);
>> + Â Â Â Â Â Â spin_lock_irqsave(&object->lock, flags_object);
>> Â Â Â Â Â Â Â dump_object_info(object);
>> - Â Â Â Â Â Â spin_unlock_irqrestore(&object->lock, flags);
>> + Â Â Â Â Â Â spin_unlock_irqrestore(&object->lock, flags_object);
>
> As Pekka said, we only need spin_lock() variant here as the interrupts
> are already disabled.

OK will respin thanks.

Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/