[PATCH][2.4] Fix to allow ethtool to work with large bus #s

Olof Johansson olof at austin.ibm.com
Fri Oct 31 13:54:55 EST 2003


Julie,

Julie DeWandel wrote:
> The patch also extends the "slot_name" field of the
> pci_dev structure to 10 characters to accommodate the longer name. Note
> that extending this field does not affect ethtool since "slot_name" is
> copied into the 32-character "bus_info" field of the ethtool_drvinfo
> structure that is written to user space.

On some very large configs, we allocate (sparse) PCI bus numbers, sometimes larger than 256. There's
still a little room in the string, since the other parts can maximum take up 6 characters (':' + 2
hex + '.' + 1 dec + '\0'). snprintf() would protect against writing over the following fields at least.

Why not allocate 12 characters while you're at it, since that's what the field will be rounded up to
in the struct?

Besides that, the patch looks good to me.


-Olof

--
Olof Johansson                                        Office: 4E002/905
pSeries Linux Development                             IBM Systems Group
Email: olof at austin.ibm.com                          Phone: 512-838-9858
All opinions are my own and not those of IBM


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list