Skip to content

Commit

Permalink
PCI: pci-stub: ignore zero-length id parameters
Browse files Browse the repository at this point in the history
pci-stub uses strsep() to separate list of ids and generates a warning
message when it fails to parse an id.  However, not specifying the
parameter results in ids set to an empty string.  strsep() happily
returns the empty string as the first token and thus triggers the
warning message spuriously.

Make the tokner ignore zero length ids.

Reported-by: Chris Wright <chrisw@sous-sol.org>
Reported-by: Prasad Joshi <P.G.Joshi@student.reading.ac.uk>
Cc: stable@kernel.org
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Tejun Heo authored and Jesse Barnes committed Dec 23, 2010
1 parent 9b444b3 commit 99a0fad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/pci/pci-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ static int __init pci_stub_init(void)
subdevice = PCI_ANY_ID, class=0, class_mask=0;
int fields;

if (!strlen(id))
continue;

fields = sscanf(id, "%x:%x:%x:%x:%x:%x",
&vendor, &device, &subvendor, &subdevice,
&class, &class_mask);
Expand Down

0 comments on commit 99a0fad

Please sign in to comment.