On Fri, Dec 18, 2015 at 12:35 AM, Hannes Reinecke <hare@xxxxxxx> wrote:Ah. (I'm a bit confused about the proposed action for VPD other than function 0).
PCI-2.2 VPD entries have a maximum size of 32k, but might actually
be smaller than that. To figure out the actual size one has to read
the VPD area until the 'end marker' is reached.
Trying to read VPD data beyond that marker results in 'interesting'
effects, from simple read errors to crashing the card. And to make
matters worse not every PCI card implements this properly, leaving
us with no 'end' marker or even completely invalid data.
This path modifies the size of the VPD attribute to the available
size, or set it to '0' if no valid data could be read.
This isn't what I had in mind. There is no need to add an f0 version
of the size function. The size for all functions other than function
0 when the F0 flag is set is 0. We aren't going to be reading their
VPD, we only read the VPD region of function 0.