lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <19f34abd0801271207j377fba5bg92cedceedbdd228@mail.gmail.com>
Date:	Sun, 27 Jan 2008 21:07:01 +0100
From:	"Vegard Nossum" <vegard.nossum@...il.com>
To:	"Jim Houston" <jim.houston@...r.com>
Cc:	"Ingo Molnar" <mingo@...e.hu>, "Tejun Heo" <htejun@...il.com>,
	"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: lib/idr.c: initialize struct idr_layer

Hi,

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):

line 135 (sub_alloc): bm = ~p->bitmap;
p->bitmap is uninitialized

line 171 (sub_alloc): if (!p->ary[m]) {
p->ary is uninitialized

line 249 (idr_get_new_above_int): pa[0]->count++;
pa[0]->count is uninitialized

I cannot guarantee that these are truly errors, but I would be
grateful if you could help me confirm/deny the validity of the
reports. Personally, I can get rid of the errors using this patch:

diff --git a/lib/idr.c b/lib/idr.c
index afbb0b1..dd28ee5 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -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;
        }
        spin_unlock_irqrestore(&idp->lock, flags);
        return(p);


Thanks a lot.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ