From: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
To: Andi Kleen <ak@suse.de>
Cc: David Brownell <david-b@pacbell.net>,
linux-kernel@vger.kernel.org, greg@kroah.com, mochel@osdl.org,
linux-usb-devel@lists.sourceforge.net
Subject: Re: [linux-usb-devel] [RFC] consolidate /sbin/hotplug call for pci and usb
Date: Wed, 25 Sep 2002 17:46:12 -0700 [thread overview]
Message-ID: <20020925174612.A13467@one-eyed-alien.net> (raw)
In-Reply-To: <p73k7l9si6p.fsf@oldwotan.suse.de>; from ak@suse.de on Thu, Sep 26, 2002 at 02:33:50AM +0200
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
On Thu, Sep 26, 2002 at 02:33:50AM +0200, Andi Kleen wrote:
> David Brownell <david-b@pacbell.net> writes:
>
> > > + /* stuff we want to pass to /sbin/hotplug */
> > > + envp[i++] = scratch;
> > > + scratch += sprintf (scratch, "PCI_CLASS=%04X", pdev->class) + 1;
> > > +
> > > + envp[i++] = scratch;
> > > + scratch += sprintf (scratch, "PCI_ID=%04X:%04X",
> > > + pdev->vendor, pdev->device) + 1;
> >
> > And so forth. Use "snprintf" and prevent overrunning those buffers...
>
> Hmm? An %04X format is perfectly bounded.
Technically, it isn't bounded. The field will expand if the value exceeds
4 digits.
However, these values can't do that. At least not now.
But, as a good programming practice, snprintf should be used. Heck, PCI
3.0 might use 32-bit vendor and device values, instead of 8 bit. So, if
nothing else, do it as insurance for the future.
Matt
--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver
It was a new hope.
-- Dust Puppy
User Friendly, 12/25/1998
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next prev parent reply other threads:[~2002-09-26 0:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20020925212955.GA32487@kroah.com.suse.lists.linux.kernel>
[not found] ` <3D9250CD.7090409@pacbell.net.suse.lists.linux.kernel>
2002-09-26 0:33 ` Andi Kleen
2002-09-26 0:46 ` Matthew Dharm [this message]
2002-09-26 1:01 ` Andi Kleen
2002-09-26 2:30 ` David Brownell
2002-09-25 21:29 Greg KH
2002-09-26 0:11 ` [linux-usb-devel] " David Brownell
2002-09-26 0:25 ` Greg KH
2002-09-26 2:44 ` David Brownell
2002-09-26 4:27 ` Greg KH
2002-09-26 16:14 ` David Brownell
2002-09-26 18:43 ` Greg KH
2002-09-26 19:32 ` David Brownell
2002-09-26 19:34 ` Alan Stern
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=20020925174612.A13467@one-eyed-alien.net \
--to=mdharm-kernel@one-eyed-alien.net \
--cc=ak@suse.de \
--cc=david-b@pacbell.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=mochel@osdl.org \
--subject='Re: [linux-usb-devel] [RFC] consolidate /sbin/hotplug call for pci and usb' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).