From: Kurt Garloff <garloff@suse.de>
To: Evan Parker <nave@stanford.edu>
Cc: linux-kernel@vger.kernel.org, mc@cs.stanford.edu
Subject: Re: [CHECKER] null-deref errors for 2.4.7
Date: Mon, 30 Jul 2001 02:38:04 +0200 [thread overview]
Message-ID: <20010730023804.H25964@pckurt.casa-etp.nl> (raw)
In-Reply-To: <Pine.GSO.4.31.0107241528560.20515-100000@myth8.Stanford.EDU>
In-Reply-To: <Pine.GSO.4.31.0107241528560.20515-100000@myth8.Stanford.EDU>
[-- Attachment #1: Type: text/plain, Size: 3108 bytes --]
Hi Evan,
thanks for your report!
On Tue, Jul 24, 2001 at 03:31:26PM -0700, Evan Parker wrote:
> Enclosed are 100 bugs found by an automatic checker that checks
> the internal consistency of code with respect to pointer dereferences and
> comparisons to NULL.
[...]
> The most common pattern the checker found was when a pointer is
> dereferenced in a declaration initialization, and then immidately checked
> against NULL. The following code, one example of this pattern, was found
> copied and pasted almost verbatim in over 20 different locations.
[...]
> Overall, this checker is pretty robust, with a very low false positive
> rate. On kernel 2.4.7, it found 146 possible errors, of which 100 were
> obvious bugs, 18 were false positives, and the rest were unknown (usually
> because the dereference and the check happened too far apart).
> Furthermore, the majority of the false positives were triggered by macro
> expansions that included checks against NULL.
>
>
> # Summary for 2.4.7
> # Total Errors = 100
> # BUGs | File Name
[...]
> 2 | drivers/scsi/tmscsim.c/
[...]
> [BUG]
> drivers/scsi/tmscsim.c:2571:dc390_set_info: ERROR:INTERNAL_NULL2:2557:2571: Checked "pos" against null AFTER dereferencing it! [nbytes = 1] [distance=25]
> int dum = 0;
> char dev;
> PDCB pDCB = pACB->pLinkDCB;
> DC390_IFLAGS
> DC390_AFLAGS
> Start --->
> pos[length] = 0;
>
> DC390_LOCK_IO;
> DC390_LOCK_ACB;
> /* UPPERCASE */
> /* Don't use kernel toupper, because of 2.0.x bug: ctmp unexported */
> while (*pos)
> { if (*pos >='a' && *pos <= 'z') *pos = *pos + 'A' - 'a'; pos++; };
>
> /* We should protect __strtok ! */
> /* spin_lock (strtok_lock); */
>
> /* Remove WS */
> pos = strtok (buffer, " \t:\n=,;");
> Error --->
> if (!pos) goto ok;
>
> next:
> if (!memcmp (pos, "RESET", 5)) goto reset;
> ---------------------------------------------------------
> [BUG]
> drivers/scsi/tmscsim.c:2658:dc390_set_info: ERROR:INTERNAL_NULL2:2653:2658: Checked "pos" against null AFTER passing it to "simple_strtoul"! [nbytes = 1] [distance=26]
> if (!pos) goto ok;
> /* decimal */
> if (pos-1 == pdec)
> {
> int dumold = dum;
> Start --->
> dum = simple_strtoul (pos, &p0, 10) * 10;
> for (; p0-pos > 1; p0--) dum /= 10;
> pDCB->NegoPeriod = (100000/(100*dumold + dum)) >> 2;
> if (pDCB->NegoPeriod < 19) pDCB->NegoPeriod = 19;
> pos = strtok (0, " \t\n:=,;");
> Error --->
> if (!pos) goto ok;
> };
> if (*pos == 'M') pos = strtok (0, " \t\n:=,;");
> if (pDCB->NegoPeriod != olddevmode) needs_inquiry++;
> ---------------------------------------------------------
Both places look correct to me, as the check is after a token has been
searched for with strtok ().
Please contradict if you think I'm wrong.
Regards,
--
Kurt Garloff <garloff@suse.de> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE GmbH, Nuernberg, DE SCSI, Security
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next prev parent reply other threads:[~2001-07-30 0:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-24 22:31 Evan Parker
2001-07-24 22:56 ` Jeff Garzik
2001-07-30 0:38 ` Kurt Garloff [this message]
2001-08-11 0:49 ` David Woodhouse
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=20010730023804.H25964@pckurt.casa-etp.nl \
--to=garloff@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mc@cs.stanford.edu \
--cc=nave@stanford.edu \
/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
all inboxes | Powered by JetHome®