qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/6] util/qemu-timer: fix uninitialized variable warning in t


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 3/6] util/qemu-timer: fix uninitialized variable warning in timer_mod_anticipate_ns()
Date: Tue, 3 Nov 2020 03:13:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 11/3/20 2:52 AM, Chen Qun wrote:
> After the WITH_QEMU_LOCK_GUARD macro is added, the compiler cannot identify
>  that the statements in the macro must be executed. As a result, some 
> variables
>  assignment statements in the macro may be considered as unexecuted by the 
> compiler.
> 
> The compiler showed warning:
> util/qemu-timer.c: In function ‘timer_mod_anticipate_ns’:
> util/qemu-timer.c:474:8: warning: ‘rearm’ may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>   474 |     if (rearm) {
>       |        ^
> 
> Change the default value assignment place to prevented the warning.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  util/qemu-timer.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]