Skip to contentSkip to conversation

ubifs: force prandom result to __le32

PATCH New Ben Dooks (Codethink) 1 participant 1 message Oct 16, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubifs: force prandom result to __le32

In set_dent_cookie() the result of prandom_u32() is assinged to an __le32 type. Make this a forced conversion to remove the following sparse warning:

fs/ubifs/journal.c:506:30: warning: incorrect type in assignment (different base types)
fs/ubifs/journal.c:506:30: expected restricted __le32 [usertype] cookie
fs/ubifs/journal.c:506:30: got unsigned int

---
Cc: Richard Weinberger <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 fs/ubifs/journal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ubifs/journal.c +1 -1
index 4fd9683b8245..d6136f7c1cfc 100644
@@ -503,7 +503,7 @@ static void mark_inode_clean(struct ubifs_info *c, struct ubifs_inode *ui)
 static void set_dent_cookie(struct ubifs_info *c, struct ubifs_dent_node *dent)
 {
 	if (c->double_hash)
-		dent->cookie = prandom_u32();
+		dent->cookie = (__force __le32) prandom_u32();
 	else
 		dent->cookie = 0;
 }
Signature · 1 line
2.23.0