From: Kasper Dupont <kasperd@daimi.au.dk>
To: Dawson Engler <engler@csl.Stanford.EDU>,
Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [CHECKER] 54 missing null pointer checks in 2.4.17
Date: Mon, 10 Jun 2002 07:22:35 +0200 [thread overview]
Message-ID: <3D04379B.1DE4CF8C@daimi.au.dk> (raw)
In-Reply-To: <200206100355.UAA17040@csl.Stanford.EDU>
Dawson Engler wrote:
>
> Enclosed are 54 potential errors where code gets a pointer from a
> possibly-failing routine (kmalloc, etc) and dereferences it without
> checking. Many follow the simple pattern of alloc-memset:
>
> dev->priv = kmalloc(sizeof(struct awc_private),GFP_KERNEL );
> memset(dev->priv,0,sizeof(struct awc_private));
>
> If these kind of errors are useful, let me know --- there are *many*
> others that I didn't inspect.
They surely look useful. Catching errors this way is better than having
to experience every one on a production system before they are found.
There are some false positives, but compared to the actual number of
bugs found, that is not a problem.
> [BUG] (synonums aren't working)
> /u2/engler/mc/oses/linux/2.4.17/drivers/net/eexpress.c:1088:eexp_hw_probe:
> ERROR:NULL:1083:1088:Using ptr "lp" illegally! set by 'kmalloc':1083
> [COUNTER=kmalloc:1083] [fit=1] [fit_fn=5] [fn_ex=0] [fn_counter=1]
> [ex=1399] [counter=26] [z = 5.50002098543802] [fn-z = -4.35889894354067]
> }
>
> buswidth = !((setupval & 0x400) >> 10);
> }
>
> Start --->
> dev->priv = lp = kmalloc(sizeof(struct net_local), GFP_KERNEL);
> if (!dev->priv)
> return -ENOMEM;
>
> memset(dev->priv, 0, sizeof(struct net_local));
> Error --->
> spin_lock_init(&lp->lock);
This one isn't a bug. The pointer to allocated memory is stored in two
variables. Only one of them is verified against NULL, that is enough.
--
Kasper Dupont -- der bruger for meget tid på usenet.
For sending spam use mailto:razor-report@daimi.au.dk
next prev parent reply other threads:[~2002-06-10 5:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-10 3:55 [CHECKER] 54 missing null pointer checks in 2.4.17 Dawson Engler
2002-06-10 5:22 ` Kasper Dupont [this message]
2002-06-10 5:56 ` Dawson Engler
2002-06-10 5:28 ` Andreas Dilger
2002-06-10 6:07 ` Dawson Engler
2002-06-10 6:35 ` Andreas Dilger
2002-06-10 7:05 ` Dawson Engler
2002-06-10 7:19 ` Giuliano Pochini
2002-06-10 12:40 ` john slee
2002-06-10 7:03 ` Brad Hards
2002-06-10 7:08 ` Dawson Engler
2002-06-11 0:30 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D04379B.1DE4CF8C@daimi.au.dk \
--to=kasperd@daimi.au.dk \
--cc=engler@csl.Stanford.EDU \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox