Patchwork UBIFS: change | to & in assertion

login
register
mail settings
Submitter Dan Carpenter
Date June 9, 2012, 9:08 a.m.
Message ID <20120609090823.GA877@elgon.mountain>
Download mbox | patch
Permalink /patch/163905/
State Accepted
Commit 1cfb7271076a265b7c2cbbf9cf5c2ae060a24385
Headers show

Comments

Dan Carpenter - June 9, 2012, 9:08 a.m.
The asserts here never check anything because it uses '|' instead of
'&'.  Now if the flags are not set it prints a warning a a stack trace.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff.  I have not tested this and it really does need to
be tested.
Artem Bityutskiy - June 18, 2012, 11:20 a.m.
On Sat, 2012-06-09 at 12:08 +0300, Dan Carpenter wrote:
> The asserts here never check anything because it uses '|' instead of
> '&'.  Now if the flags are not set it prints a warning a a stack trace.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Pushed to linux-ubifs.git, thanks!

Patch

diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 2559d17..28ec13a 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -939,8 +939,8 @@  static int find_dirtiest_idx_leb(struct ubifs_info *c)
 	}
 	dbg_find("LEB %d, dirty %d and free %d flags %#x", lp->lnum, lp->dirty,
 		 lp->free, lp->flags);
-	ubifs_assert(lp->flags | LPROPS_TAKEN);
-	ubifs_assert(lp->flags | LPROPS_INDEX);
+	ubifs_assert(lp->flags & LPROPS_TAKEN);
+	ubifs_assert(lp->flags & LPROPS_INDEX);
 	return lnum;
 }