HomeFreeBSD

pci: propagate vpd read error

Description

pci: propagate vpd read error

On read error, we would return -1, but not handle it, causing a zero
size malloc of value, and then we wouldd unconditionally write
value[-1 + 1] = '\0'. This should be harmless in terms of buffer
overflow because we should get a minimum non-zero size allocation from
malloc, but it also effectively swallowed the error.

Reported by: GCC -Wstringop-overflow
Reviewed by: kib, se
Differential Revision: https://reviews.freebsd.org/D45895

(cherry picked from commit 39bda097c03780e26e6a25ff59a3e8e77c77563f)

Details

Provenance
rlibbyAuthored on Jul 7 2024, 11:46 PM
jhbCommitted on Apr 29 2025, 2:17 PM
Reviewer
kib
Differential Revision
D45895: pci: propagate vpd read error
Parents
rG62c010b6514b: LinuxKPI: define time64_t
Branches
Unknown
Tags
Unknown