[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for 6.0 v4] hw/intc/i8259: Refactor pic_read_irq() to avoid u
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH for 6.0 v4] hw/intc/i8259: Refactor pic_read_irq() to avoid uninitialized variable |
Date: |
Fri, 19 Mar 2021 15:29:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 |
On 3/19/21 3:23 PM, Philippe Mathieu-Daudé wrote:
> Some compiler versions are smart enough to detect a potentially
> uninitialized variable, but are not smart enough to detect that this
> cannot happen due to the code flow:
>
> ../hw/intc/i8259.c: In function ‘pic_read_irq’:
> ../hw/intc/i8259.c:203:13: error: ‘irq2’ may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> 203 | irq = irq2 + 8;
> | ~~~~^~~~~~~~~~
>
> Restrict irq2 variable use to the inner statement.
>
> Fixes: 78ef2b6989f ("i8259: Reorder intack in pic_read_irq")
> Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Since v3:
> - Declare irq2 really local (Richard)
I forgot to keep:
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>