[PATCH] common: fix incorrect comparison
Maks Mishin
maks.mishinfz at gmail.com
Mon Jan 27 17:03:50 CET 2025
The variable n, which is of type size_t and cannot have negative values,
is checked for a negative value in dlmalloc.c:2107.
Signed-off-by: Maks Mishin <maks.mishinFZ at gmail.com>
---
common/dlmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index cc4d3a0a02..a4182a8dd6 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -2104,7 +2104,7 @@ Void_t* cALLOc_impl(n, elem_size) size_t n; size_t elem_size;
#endif
Void_t* mem = mALLOc_impl (sz);
- if ((long)n < 0) return NULL;
+ if ((long)n <= 0) return NULL;
if (mem == NULL)
return NULL;
--
2.34.1
More information about the U-Boot
mailing list