linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi/osl: clear high bits in acpi_os_read_memory value
@ 2014-07-07 19:38 Paul Gortmaker
  2014-07-07 20:15 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Gortmaker @ 2014-07-07 19:38 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel, Paul Gortmaker

If one looks at acpi_os_read_port() it is very similar to the
acpi_os_read_memory() aside from the underlying I/O method.
However we zero out the u32 in the former and not in the latter,
when it seems prudent to do so in both.

This was found by quasi-random code inspection, and as such there
is no known symptom or bug to associate with possibly having stale
data in the high bits of "value".

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/acpi/osl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index bad25b070fe0..a7373f1f31c8 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -953,6 +953,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
 	if (!value)
 		value = &dummy;
 
+	*value = 0;
 	switch (width) {
 	case 8:
 		*(u8 *) value = readb(virt_addr);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] acpi/osl: clear high bits in acpi_os_read_memory value
  2014-07-07 19:38 [PATCH] acpi/osl: clear high bits in acpi_os_read_memory value Paul Gortmaker
@ 2014-07-07 20:15 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2014-07-07 20:15 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Len Brown, linux-acpi, linux-kernel, Lv Zheng

On Monday, July 07, 2014 03:38:53 PM Paul Gortmaker wrote:
> If one looks at acpi_os_read_port() it is very similar to the
> acpi_os_read_memory() aside from the underlying I/O method.
> However we zero out the u32 in the former and not in the latter,
> when it seems prudent to do so in both.
> 
> This was found by quasi-random code inspection, and as such there
> is no known symptom or bug to associate with possibly having stale
> data in the high bits of "value".

I'm actually afraid that this may lead to regressions, because the caller's
intention may be to leave the higher bits untouched.  So I'd think some audit
of the existing callers would be necessary before making this change.

> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/acpi/osl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index bad25b070fe0..a7373f1f31c8 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -953,6 +953,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
>  	if (!value)
>  		value = &dummy;
>  
> +	*value = 0;
>  	switch (width) {
>  	case 8:
>  		*(u8 *) value = readb(virt_addr);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-07 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07 19:38 [PATCH] acpi/osl: clear high bits in acpi_os_read_memory value Paul Gortmaker
2014-07-07 20:15 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).