Browse Source

[JFFS2] jffs2_acl_count() tests < 0 on unsigned

size_t s is unsigned and cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Roel Kluin 16 years ago
parent
commit
fc371a25ea
1 changed files with 2 additions and 2 deletions
  1. 2 2
      fs/jffs2/acl.c

+ 2 - 2
fs/jffs2/acl.c

@@ -38,12 +38,12 @@ static int jffs2_acl_count(size_t size)
 	size_t s;
 	size_t s;
 
 
 	size -= sizeof(struct jffs2_acl_header);
 	size -= sizeof(struct jffs2_acl_header);
-	s = size - 4 * sizeof(struct jffs2_acl_entry_short);
-	if (s < 0) {
+	if (size < 4 * sizeof(struct jffs2_acl_entry_short)) {
 		if (size % sizeof(struct jffs2_acl_entry_short))
 		if (size % sizeof(struct jffs2_acl_entry_short))
 			return -1;
 			return -1;
 		return size / sizeof(struct jffs2_acl_entry_short);
 		return size / sizeof(struct jffs2_acl_entry_short);
 	} else {
 	} else {
+		s = size - 4 * sizeof(struct jffs2_acl_entry_short);
 		if (s % sizeof(struct jffs2_acl_entry))
 		if (s % sizeof(struct jffs2_acl_entry))
 			return -1;
 			return -1;
 		return s / sizeof(struct jffs2_acl_entry) + 4;
 		return s / sizeof(struct jffs2_acl_entry) + 4;