[JFFS2] jffs2_acl_count() tests < 0 on unsigned
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Mar 20 14:59:24 EDT 2009
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=fc371a25eab8816d49c2d322d91b48a11e206018
Commit: fc371a25eab8816d49c2d322d91b48a11e206018
Parent: a4b6d516a6079c6ba8dc97d185371439035a35d0
Author: Roel Kluin <roel.kluin at gmail.com>
AuthorDate: Wed Mar 4 12:01:41 2009 -0800
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Mar 20 13:18:50 2009 +0000
[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 at gmail.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
fs/jffs2/acl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index d987137..6e63e8b 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -38,12 +38,12 @@ static int jffs2_acl_count(size_t size)
size_t s;
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))
return -1;
return size / sizeof(struct jffs2_acl_entry_short);
} else {
+ s = size - 4 * sizeof(struct jffs2_acl_entry_short);
if (s % sizeof(struct jffs2_acl_entry))
return -1;
return s / sizeof(struct jffs2_acl_entry) + 4;
More information about the linux-mtd-cvs
mailing list