bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/7] libpager: fix assertion unsigned against 0


From: Samuel Thibault
Subject: Re: [PATCH 2/7] libpager: fix assertion unsigned against 0
Date: Thu, 20 Jan 2022 00:29:51 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Etienne Brateau, le mer. 19 janv. 2022 20:29:40 +0100, a ecrit:
> Comparing an unsigned to be superior or equals to 0 is always true,
> instead move the assert before the substraction and compare it to the
> value to substract.

Applied, thanks!

> ---
>  libpager/pager-memcpy.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libpager/pager-memcpy.c b/libpager/pager-memcpy.c
> index 12515933..5a5aac2a 100644
> --- a/libpager/pager-memcpy.c
> +++ b/libpager/pager-memcpy.c
> @@ -130,13 +130,13 @@ pager_memcpy (struct pager *pager, memory_object_t 
> memobj,
>             
>             vm_deallocate (mach_task_self (), window, window_size);
>  
> +           assert_backtrace (n >= copy_count);
> +           assert_backtrace (to_copy >= copy_count);
> +
>             offset += copy_count;
>             other += copy_count;
>             to_copy -= copy_count;
>             n -= copy_count;
> -
> -           assert_backtrace (n >= 0);
> -           assert_backtrace (to_copy >= 0);
>           }
>         while (to_copy > 0);
>         
> -- 
> 2.34.1
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]