[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] linux-user: Use "!= 0" when checking if MAP_FIXED_NOREPLACE
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] linux-user: Use "!= 0" when checking if MAP_FIXED_NOREPLACE is non-zero |
Date: |
Tue, 3 Nov 2020 15:42:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 |
On 11/3/20 3:26 PM, Peter Maydell wrote:
> In pgd_find_hole_fallback(), Coverity doesn't like the use
> of "if (MAP_FIXED_NOREPLACE || ...)" because it's using a
> logical operator on a constant other than 0 or 1 and its
> heuristic thinks we might have intended a bitwise operator
> instead.
>
> The logic is correct (we are checking whether the host really
> has a MAP_FIXED_NOREPLACE or whether we fell back to the
> "#define as 0 to ignore" from osdep.h); make Coverity
> happier by explicitly writing out the comparison with zero.
>
> Fixes: Coverity CID 1431059
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> linux-user/elfload.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>