diff mbox series

[PULL,07/24] linux-user: Do not call get_errno() in do_brk()

Message ID 20230806033715.244648-8-richard.henderson@linaro.org
State Accepted
Commit c6cc059eca18d9f6e4e26bb8b6d1135ddb35d81a
Headers show
Series [PULL,01/24] accel/tcg: Adjust parameters and locking with do_{ld, st}_mmio_* | expand

Commit Message

Richard Henderson Aug. 6, 2023, 3:36 a.m. UTC
From: Akihiko Odaki <akihiko.odaki@daynix.com>

Later the returned value is compared with -1, and negated errno is not
expected.

Fixes: 00faf08c95 ("linux-user: Don't use MAP_FIXED in do_brk()")
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-4-akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/syscall.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Michael Tokarev Aug. 6, 2023, 6:53 a.m. UTC | #1
06.08.2023 06:36, Richard Henderson wrote:

> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c

> -        mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
> -                                        PROT_READ|PROT_WRITE,
> -                                        MAP_ANON|MAP_PRIVATE, 0, 0));
> +        mapped_addr = target_mmap(brk_page, new_alloc_size,
> +                                  PROT_READ|PROT_WRITE,
> +                                  MAP_ANON|MAP_PRIVATE, 0, 0);

Can't we add spaces around "|" here at apply time to make checkpatch happy?
Just a nitpick really..  I thought this will be done in some of the Vn,
but it is not.

/mjt
Richard Henderson Aug. 7, 2023, 1:23 a.m. UTC | #2
On 8/5/23 23:53, Michael Tokarev wrote:
> 06.08.2023 06:36, Richard Henderson wrote:
> 
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
> 
>> -        mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
>> -                                        PROT_READ|PROT_WRITE,
>> -                                        MAP_ANON|MAP_PRIVATE, 0, 0));
>> +        mapped_addr = target_mmap(brk_page, new_alloc_size,
>> +                                  PROT_READ|PROT_WRITE,
>> +                                  MAP_ANON|MAP_PRIVATE, 0, 0);
> 
> Can't we add spaces around "|" here at apply time to make checkpatch happy?
> Just a nitpick really..  I thought this will be done in some of the Vn,
> but it is not.

Since I had to re-spin, I did so.


r~
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 95727a816a..b9d2ec02f9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -862,9 +862,9 @@  abi_long do_brk(abi_ulong brk_val)
      */
     if (new_host_brk_page > brk_page) {
         new_alloc_size = new_host_brk_page - brk_page;
-        mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
-                                        PROT_READ|PROT_WRITE,
-                                        MAP_ANON|MAP_PRIVATE, 0, 0));
+        mapped_addr = target_mmap(brk_page, new_alloc_size,
+                                  PROT_READ|PROT_WRITE,
+                                  MAP_ANON|MAP_PRIVATE, 0, 0);
     } else {
         new_alloc_size = 0;
         mapped_addr = brk_page;