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

Julie DeWandel jdewand at redhat.com
Sat Nov 1 00:42:14 EST 2003


Good suggestions -- I changed to use snprintf and increased the
slot_name field to 12 chars (although 10 should do it -- 4 hex + ':' + 2
hex + '.' + 1 dec + '\0'). Updated patch attached. Thanks for the comments!


Olof Johansson wrote:

 > 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
 >

--
Julie DeWandel <jdewand at redhat.com>
Red Hat, Inc.
Tel (978) 692-3113 x23251



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pci_large_bus_fix.patch
Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20031031/3d4f7a74/attachment.txt 


More information about the Linuxppc64-dev mailing list