Re: [PATCH] ACPI: OSL: Initialize output value

From: Nikita Kiryushin
Date: Tue Mar 05 2024 - 06:29:56 EST


On 11/21/23 23:05, Rafael J. Wysocki wrote:
So wouldn't it be better to avoid modifying *value at all if
raw_pci_read() returns an error?

Avoiding of modification of *value at all seems better idea to me than setting it to arbitrary initializing value, indeed.

In that case, buffer initialization can be ditched, and *value set only in case of success.

And if it returns a success, why wouldn't it be trusted?

My concern is, that raw_pci_read() wraps platform-specific handlers, that should conform to the next rules:

1) in case of success, they must set value32 (or else, uninitialized data would leak to acpi_os_read_pci_configuration caller);

2) they should use passed &value32 only to set it (or else, uninitialized data would be used/passed somewhere, is it safe?);

Is there any way to be sure, that all the existing and future platform-specific pci-read handlers conform?