diff mbox series

[01/24] linux-user: Use assert in mmap_fork_start

Message ID 20230630132159.376995-2-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user: mmap range fixes | expand

Commit Message

Richard Henderson June 30, 2023, 1:21 p.m. UTC
Assert is preferred over if+abort for the error message.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/mmap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Alex Bennée July 3, 2023, 8:47 a.m. UTC | #1
Richard Henderson <richard.henderson@linaro.org> writes:

> Assert is preferred over if+abort for the error message.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Philippe Mathieu-Daudé July 3, 2023, 3:56 p.m. UTC | #2
On 30/6/23 15:21, Richard Henderson wrote:
> Assert is preferred over if+abort for the error message.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/mmap.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 0aa8ae7356..83cbcce769 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -49,8 +49,7 @@  bool have_mmap_lock(void)
 /* Grab lock to make sure things are in a consistent state after fork().  */
 void mmap_fork_start(void)
 {
-    if (mmap_lock_count)
-        abort();
+    assert(mmap_lock_count == 0);
     pthread_mutex_lock(&mmap_mutex);
 }