qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/omap_intc.c: Avoid crash on access to nonexistent banked registers
@ 2011-11-09 18:45 Peter Maydell
  2011-11-11 19:44 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2011-11-09 18:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

Avoid a crash due to null pointer dereference if a guest attempts
to access banked registers for a nonexistent bank. Spotted by
Coverity (see bug 887883).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/omap_intc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/omap_intc.c b/hw/omap_intc.c
index 0f7fd9d..45efa25 100644
--- a/hw/omap_intc.c
+++ b/hw/omap_intc.c
@@ -398,6 +398,9 @@ static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
         if (bank_no < s->nbanks) {
             offset &= ~0x60;
             bank = &s->bank[bank_no];
+        } else {
+            OMAP_BAD_REG(addr);
+            return 0;
         }
     }
 
@@ -476,6 +479,9 @@ static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
         if (bank_no < s->nbanks) {
             offset &= ~0x60;
             bank = &s->bank[bank_no];
+        } else {
+            OMAP_BAD_REG(addr);
+            return;
         }
     }
 
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] hw/omap_intc.c: Avoid crash on access to nonexistent banked registers
  2011-11-09 18:45 [Qemu-devel] [PATCH] hw/omap_intc.c: Avoid crash on access to nonexistent banked registers Peter Maydell
@ 2011-11-11 19:44 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2011-11-11 19:44 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On 11/09/2011 12:45 PM, Peter Maydell wrote:
> Avoid a crash due to null pointer dereference if a guest attempts
> to access banked registers for a nonexistent bank. Spotted by
> Coverity (see bug 887883).
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/omap_intc.c |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/hw/omap_intc.c b/hw/omap_intc.c
> index 0f7fd9d..45efa25 100644
> --- a/hw/omap_intc.c
> +++ b/hw/omap_intc.c
> @@ -398,6 +398,9 @@ static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
>           if (bank_no<  s->nbanks) {
>               offset&= ~0x60;
>               bank =&s->bank[bank_no];
> +        } else {
> +            OMAP_BAD_REG(addr);
> +            return 0;
>           }
>       }
>
> @@ -476,6 +479,9 @@ static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
>           if (bank_no<  s->nbanks) {
>               offset&= ~0x60;
>               bank =&s->bank[bank_no];
> +        } else {
> +            OMAP_BAD_REG(addr);
> +            return;
>           }
>       }
>

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

end of thread, other threads:[~2011-11-11 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 18:45 [Qemu-devel] [PATCH] hw/omap_intc.c: Avoid crash on access to nonexistent banked registers Peter Maydell
2011-11-11 19:44 ` Anthony Liguori

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).