lkml.org 
[lkml]   [2008]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: lib/idr.c: initialize struct idr_layer
Hi Vegard,

On Jan 27, 2008 10:07 PM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> I am testing my kmemcheck patches, and it has come up with a couple of
> uses of uninitialized memory in lib/idr.c. These are (the line numbers
> may differ slightly):

[snip]

> @@ -39,12 +39,16 @@ static struct idr_layer *alloc_layer(struct idr *idp)
> {
> struct idr_layer *p;
> unsigned long flags;
> + int i;
>
> spin_lock_irqsave(&idp->lock, flags);
> if ((p = idp->id_free)) {
> idp->id_free = p->ary[0];
> idp->id_free_cnt--;
> - p->ary[0] = NULL;
> + p->bitmap = 0;
> + for(i = 0; i < ARRAY_SIZE(p->ary); ++i)
> + p->ary[i] = NULL;
> + p->count = 0;

But aren't these zeroed by idr_cache_ctor() already?

> }
> spin_unlock_irqrestore(&idp->lock, flags);
> return(p);

Pekka


\
 
 \ /
  Last update: 2008-01-27 22:03    [W:0.117 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site