linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ext4: underflow in alignment check
@ 2016-06-16  7:07 Dan Carpenter
  2016-06-20 16:02 ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2016-06-16  7:07 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Andreas Dilger, linux-ext4, linux-kernel, kernel-janitors

My static checker complains that this can underflow if arg is negative
which is true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b1a3471..a2a17e9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1576,7 +1576,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 	} else if (token == Opt_min_batch_time) {
 		sbi->s_min_batch_time = arg;
 	} else if (token == Opt_inode_readahead_blks) {
-		if (arg && (arg > (1 << 30) || !is_power_of_2(arg))) {
+		if (arg && (arg > (1U << 30) || !is_power_of_2(arg))) {
 			ext4_msg(sb, KERN_ERR,
 				 "EXT4-fs: inode_readahead_blks must be "
 				 "0 or a power of 2 smaller than 2^31");

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-21 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-16  7:07 [patch] ext4: underflow in alignment check Dan Carpenter
2016-06-20 16:02 ` Jan Kara
2016-06-20 19:53   ` Dan Carpenter
2016-06-21  7:43     ` Jan Kara
2016-06-21 13:06       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).