Message ID | 20240511115400.7587-3-richard.henderson@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | RISU misc updates | expand |
On 11/5/24 13:53, Richard Henderson wrote: > mmap does not return null on failure, but MAP_FAILED. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > risu.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/risu.c b/risu.c index 36fc82a..6b6295c 100644 --- a/risu.c +++ b/risu.c @@ -362,10 +362,9 @@ static void load_image(const char *imgfile) /* Map writable because we include the memory area for store * testing in the image. */ - addr = - mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, - 0); - if (!addr) { + addr = mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, fd, 0); + if (addr == MAP_FAILED) { perror("mmap"); exit(EXIT_FAILURE); }
mmap does not return null on failure, but MAP_FAILED. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- risu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)