diff mbox series

[V2] ppc/spapr_events: fix potential NULL pointer dereference in rtas_event_log_dequeue

Message ID 1574685291-38176-1-git-send-email-pannengyuan@huawei.com (mailing list archive)
State New, archived
Headers show
Series [V2] ppc/spapr_events: fix potential NULL pointer dereference in rtas_event_log_dequeue | expand

Commit Message

Pan Nengyuan Nov. 25, 2019, 12:34 p.m. UTC
From: PanNengyuan <pannengyuan@huawei.com>

This fixes coverity issues 68911917:
        360
    CID 68911917: (NULL_RETURNS)
        361. dereference: Dereferencing "source", which is known to be
             "NULL".
        361        if (source->mask & event_mask) {
        362            break;
        363        }

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: PanNengyuan <pannengyuan@huawei.com>
---
 hw/ppc/spapr_events.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Gibson Nov. 25, 2019, 11:13 p.m. UTC | #1
On Mon, Nov 25, 2019 at 08:34:51PM +0800, pannengyuan@huawei.com wrote:
> From: PanNengyuan <pannengyuan@huawei.com>
> 
> This fixes coverity issues 68911917:
>         360
>     CID 68911917: (NULL_RETURNS)
>         361. dereference: Dereferencing "source", which is known to be
>              "NULL".
>         361        if (source->mask & event_mask) {
>         362            break;
>         363        }
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: PanNengyuan <pannengyuan@huawei.com>

Applied to ppc-for-4.2, thanks.

> ---
>  hw/ppc/spapr_events.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
> index 0e4c195..e355e00 100644
> --- a/hw/ppc/spapr_events.c
> +++ b/hw/ppc/spapr_events.c
> @@ -358,6 +358,7 @@ static SpaprEventLogEntry *rtas_event_log_dequeue(SpaprMachineState *spapr,
>              rtas_event_log_to_source(spapr,
>                                       spapr_event_log_entry_type(entry));
>  
> +        g_assert(source);
>          if (source->mask & event_mask) {
>              break;
>          }
diff mbox series

Patch

diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index 0e4c195..e355e00 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -358,6 +358,7 @@  static SpaprEventLogEntry *rtas_event_log_dequeue(SpaprMachineState *spapr,
             rtas_event_log_to_source(spapr,
                                      spapr_event_log_entry_type(entry));
 
+        g_assert(source);
         if (source->mask & event_mask) {
             break;
         }