2002-09-26 00:06:42

by David Brownell

[permalink] [raw]
Subject: Re: [linux-usb-devel] [RFC] consolidate /sbin/hotplug call for pci and usb


> + /* 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...

- Dave



2002-09-26 00:22:02

by Greg KH

[permalink] [raw]
Subject: Re: [linux-usb-devel] [RFC] consolidate /sbin/hotplug call for pci and usb

On Wed, Sep 25, 2002 at 05:11:57PM -0700, David Brownell wrote:
>
> >+ /* 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...

Doh, will do.

I also found the unload USB module problem. The driver core was calling
hotplug after the device was already removed. Made it a bit difficult
to be able to describe the device that way :)

thanks,

greg k-h