All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] acpi: check if mapping is valid before reading / writing
@ 2017-03-01 11:07 Wei Liu
  2017-03-01 11:23 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Liu @ 2017-03-01 11:07 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, Jan Beulich

If acpi_map_os_memory has failed, return early with AE_ERROR.

Coverity-ID: 1401601
Coverity-ID: 1401602

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <JBeulich@suse.com>
---
 xen/drivers/acpi/osl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index 94dbf0406f..9881db19da 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -155,6 +155,9 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
 	u32 dummy;
 	void __iomem *virt_addr = acpi_os_map_memory(phys_addr, width >> 3);
 
+	if (!virt_addr)
+		return AE_ERROR;
+
 	if (!value)
 		value = &dummy;
 
@@ -182,6 +185,9 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
 {
 	void __iomem *virt_addr = acpi_os_map_memory(phys_addr, width >> 3);
 
+	if (!virt_addr)
+		return AE_ERROR;
+
 	switch (width) {
 	case 8:
 		writeb(value, virt_addr);
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH 2/2] acpi: check if mapping is valid before reading / writing
  2017-03-01 11:07 [PATCH 2/2] acpi: check if mapping is valid before reading / writing Wei Liu
@ 2017-03-01 11:23 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2017-03-01 11:23 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel

>>> On 01.03.17 at 12:07, <wei.liu2@citrix.com> wrote:
> If acpi_map_os_memory has failed, return early with AE_ERROR.
> 
> Coverity-ID: 1401601
> Coverity-ID: 1401602
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-03-01 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 11:07 [PATCH 2/2] acpi: check if mapping is valid before reading / writing Wei Liu
2017-03-01 11:23 ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.