victim is defined as:

typedef struct malloc_chunk* mchunkptr;
mchunkptr victim;

So victim should be compared to NULL and not to 0.

Problem identified with Coccinelle.

Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
 common/dlmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index c37979b43f..86bbd57a4c 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1461,7 +1461,7 @@ Void_t* mALLOc(bytes) size_t bytes;
 #if HAVE_MMAP
     /* If big and would otherwise need to extend, try to use mmap instead */
     if ((unsigned long)nb >= (unsigned long)mmap_threshold &&
-       (victim = mmap_chunk(nb)) != 0)
+       (victim = mmap_chunk(nb)) != NULL)
       return chunk2mem(victim);
 #endif
 
-- 
2.14.2

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to