public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: yxie@cs.stanford.edu
Cc: linux-kernel@vger.kernel.org
Subject: Re:  [CHECKER] 87 potential array bounds error/buffer overruns in 2.5.53
Date: Tue, 28 Jan 2003 10:28:15 -0800	[thread overview]
Message-ID: <3E36CBBF.6000309@pacbell.net> (raw)

> ---------------------------------------------------------
> [BUG] possible, but not sure

Call this a USB 1.0 design bug, partially papered over in the code.

There are two adjacent variable length bitmaps.  One of the notable
changes in USB 1.1 was to say the second bitmap isn't really used,
and must be filled with ones.

The code in 2.4.9 (or thereabouts) behaved reasonably here, by
declaring just one single bitmap and expecting users of that bitmap
to cope with its quirkiness.  But somewhere along the line that
bit map got changed to two fixed-size bitmaps.

The checker is basically complaining about a "#define bitmap"
that lets driver code be written to reflect the reality of
two adjacent variable-size bitmaps.  Quite reasonably so.

Somehow, making drivers/usb/core/hub.h go back to having a
more sensible declaration has never been high on the priority
list.  Worth fixing someday, but not a "bug" in the sense of
being incorrect -- only in the sense of being confusing.

- Dave



> /home/yxie/linux-2.5.53/drivers/usb/host/ohci-hub.c:145:ohci_hub_descrip
> tor: ERROR:BUFFER:145:145:Array bounds error (off >= len)
> ((*desc).DeviceRemovable[3], len = 3, off = 3, min(off-len) = 0) 
> 	/* two bitmaps:  ports removable, and usb 1.0 legacy
> PortPwrCtrlMask */
> 	rh = roothub_b (ohci);
> 	desc->bitmap [0] = rh & RH_B_DR;
> 	if (ports > 7) {
> 		desc->bitmap [1] = (rh & RH_B_DR) >> 8;
> 
> Error --->	desc->bitmap [2] = desc->bitmap [3] = 0xff;
> 	} else
> 		desc->bitmap [1] = 0xff;
> }



             reply	other threads:[~2003-01-28 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-28 18:28 David Brownell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-01-27  1:35 [CHECKER] 87 potential array bounds error/buffer overruns in 2.5.53 Yichen Xie
2003-01-28  7:39 ` Randy.Dunlap
2003-01-28  9:21   ` Yichen Xie
2003-01-28 17:14     ` Randy.Dunlap
2003-01-28 13:16 ` Stephen Lord
2003-01-30 19:03 ` Randy.Dunlap
2003-01-30 20:08   ` Andreas Henriksson

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=3E36CBBF.6000309@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yxie@cs.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