PCI config read functions

Andrew Goodbody andrew.goodbody at linaro.org
Mon Jul 7 16:49:51 CEST 2025


On 04/07/2025 21:59, Tom Rini wrote:
> On Fri, Jul 04, 2025 at 10:53:55AM +0100, Andrew Goodbody wrote:
>> Hi Tom,
>>
>> Smatch reports that the callers of the functions
>> (dm_)pci_config_read(8|16|32) from drivers/pci/pci-uclass.c do not check the
>> return value for an error before using the variable that should have been
>> assigned with the value read. However in the error path that variable is not
>> assigned to and so the code can use an uninitialised variable in that case.
>> eg line 1396 in drivers/pci/pci-uclass.c addr may not have been assigned to
>> in the error case.
>>
>> This also seems to be the case with callers from other files as well.
>>
>> Would a patch that adds a default assignment before returning an error to
>> the affected functions be accepted?
> 
> Can you please check the size growth on say qemu_arm* and we can go from
> there? Thanks.

Size info from buildman

    aarch64: (for 3/3 boards) all +26.7 rodata +2.7 text +24.0
        arm: (for 1/1 boards) all +16.0 text +16.0

Andrew


More information about the U-Boot mailing list