mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] qsort: Fix wrong check
@ 2012-08-03  6:30 Sascha Hauer
  2012-08-03  6:30 ` [PATCH 2/2] glob: fix GLOB_SORT Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2012-08-03  6:30 UTC (permalink / raw)
  To: barebox; +Cc: jbe

The check for overflow accidently was exactly the opposite.

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] glob: fix GLOB_SORT
  2012-08-03  6:30 [PATCH 1/2] qsort: Fix wrong check Sascha Hauer
@ 2012-08-03  6:30 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-08-03  6:30 UTC (permalink / raw)
  To: barebox; +Cc: jbe

The arguments to collated_compare are actually pointers to
pointers to char, not pointers to char.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 lib/glob.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/glob.c b/lib/glob.c
index c4c6067..1b0137b 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -78,8 +78,8 @@ int glob_pattern_p(const char *pattern, int quote)
 /* Do a collated comparison of A and B.  */
 static int collated_compare(const void *a, const void *b)
 {
-	const char *s1 = a;
-	const char *s2 = b;
+	const char *const s1 = *(const char *const *)a;
+	const char *const s2 = *(const char *const *)b;
 
 	if (s1 == s2)
 		return 0;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-03  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-03  6:30 [PATCH 1/2] qsort: Fix wrong check Sascha Hauer
2012-08-03  6:30 ` [PATCH 2/2] glob: fix GLOB_SORT Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox