[ccan] [PATCH] talloc: avoid a comparison mismatch & at the same time switch to non-legacy sysconf()

Rusty Russell rusty at rustcorp.com.au
Mon Aug 17 12:31:54 AEST 2015


Cody P Schafer <dev at codyps.com> writes:
> Without this, gcc warns about a sign mismatch in the comparison.
>
> Signed-off-by: Cody P Schafer <dev at codyps.com>

I'm going to remove talloc (since it's a standalone library), but
a few things still need it (particularly antithread, which requires
some of the ccan/talloc modifications).

Meanwhile, I've applied this.

Thanks!
Rusty.

> ---
>  ccan/talloc/talloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ccan/talloc/talloc.c b/ccan/talloc/talloc.c
> index 0c6bcda..3ada60f 100644
> --- a/ccan/talloc/talloc.c
> +++ b/ccan/talloc/talloc.c
> @@ -810,7 +810,7 @@ void *_talloc(const void *context, size_t size)
>  
>  static int talloc_destroy_pointer(void ***pptr)
>  {
> -	if ((uintptr_t)**pptr < getpagesize())
> +	if ((uintptr_t)**pptr < (uintptr_t)sysconf(_SC_PAGESIZE))
>  		TALLOC_ABORT("Double free or invalid talloc_set?");
>  	/* Invalidate pointer so it can't be used again. */
>  	**pptr = (void *)1;
> -- 
> 2.5.0
>
> _______________________________________________
> ccan mailing list
> ccan at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/ccan


More information about the ccan mailing list