Skip to content

Commit

Permalink
[JFFS2] jffs2_acl_count() tests < 0 on unsigned
Browse files Browse the repository at this point in the history
size_t s is unsigned and cannot be less than 0.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
RoelKluin authored and David Woodhouse committed Mar 20, 2009
1 parent a4b6d51 commit fc371a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/jffs2/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fc371a2

Please sign in to comment.