summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2023-08-02 16:17:51 +0900
committerRichard Henderson <richard.henderson@linaro.org>2023-08-06 16:45:03 -0700
commitcb9d5d1fda0bc2312fc0c779b4ea1d7bf826f31f (patch)
tree7e0a1e2916a4c5562461c562ffe45ad2c88af78e /linux-user/syscall.c
parente69e032d1a8ee8d754ca119009a3c2c997f8bb30 (diff)
downloadfocaccia-qemu-cb9d5d1fda0bc2312fc0c779b4ea1d7bf826f31f.tar.gz
focaccia-qemu-cb9d5d1fda0bc2312fc0c779b4ea1d7bf826f31f.zip
linux-user: Do nothing if too small brk is specified
Linux 6.4.7 does nothing when a value smaller than the initial brk is
specified.

Fixes: 86f04735ac ("linux-user: Fix brk() to release pages")
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-6-akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f64024273f..e1436a3962 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -820,14 +820,14 @@ abi_long do_brk(abi_ulong brk_val)
 
     /* brk pointers are always untagged */
 
-    /* return old brk value if brk_val unchanged or zero */
-    if (!brk_val || brk_val == target_brk) {
+    /* return old brk value if brk_val unchanged */
+    if (brk_val == target_brk) {
         return target_brk;
     }
 
     /* do not allow to shrink below initial brk value */
     if (brk_val < initial_target_brk) {
-        brk_val = initial_target_brk;
+        return target_brk;
     }
 
     new_brk = TARGET_PAGE_ALIGN(brk_val);