[PATCH 1/2] qsort: Fix wrong check

Sascha Hauer s.hauer at pengutronix.de
Fri Aug 3 02:30:34 EDT 2012


The check for overflow accidently was exactly the opposite.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 lib/qsort.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/qsort.c b/lib/qsort.c
index f648714..d413096 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -31,7 +31,7 @@ void qsort(void  *base,
 		return;
 
 	/* check for overflow */
-	if (nel <= ((size_t)(-1)) / width)
+	if (nel > ((size_t)(-1)) / width)
 		return;
 
 	wgap = 0;
-- 
1.7.10.4




More information about the barebox mailing list