[lvc-project] [PATCH] PCI/IOV: "virtfn4294967295\0" requires 17 bytes
Alexey V. Vissarionov
gremlin at altlinux.org
Mon Dec 19 02:24:56 MSK 2022
On 2022-12-18 22:19:24 +0000, Matthew Wilcox wrote:
>>> Thank you for sending the patch over! However, if possible,
>>> can you send it as plain text without any multi-part MIME
>>> involved?
>> ACK.
>>> If possible, it would be nice to mention that this needed
>>> to make sure that there is enough space to correctly
>>> NULL-terminate the ID string.
>> ACK.
>> So, here goes the corrected text:
>> Although unlikely, the 'id' value may be as big as 4294967295
>> (uint32_max) and "virtfn4294967295\0" would require 17 bytes
>> instead of 16 to make sure that buffer has enough space to
>> properly NULL-terminate the ID string.
> Wait, what? How can we get to a number that large for the
> virtual function ID? devfn is 8 bits, bus is a further 8 bits.
> Sure, domain is an extra 16 bits on top of that but I'm pretty
> sure that virtual functions can't span multiple domains.
> Unless that's changed recently? Even if they can, we'd need
> to span 2^14 domains to get up to a billion IDs. That's a
> hell of a system and I think overflowing here is the least
> of our problems.
Possibly in some synthetic cases this may be achieved with some
specially crafted "BadPCI" (similar to "BadUSB") device...
> So while this is typed as u32, I don't think it can get
> anywhere close.
Anyway, the final decision is up to you.
--
Alexey V. Vissarionov
gremlin ПРИ altlinux ТЧК org; +vii-cmiii-ccxxix-lxxix-xlii
GPG: 0D92F19E1C0DC36E27F61A29CD17E2B43D879005 @ hkp://keys.gnupg.net
More information about the lvc-project
mailing list