Patchwork [1/4] e2p: Fix 's' handling in parse_num_blocks2()

login
register
mail settings
Submitter Jan Kara
Date Feb. 25, 2013, 3:55 p.m.
Message ID <1361807708-15871-2-git-send-email-jack@suse.cz>
Download mbox | patch
Permalink /patch/222946/
State Accepted
Headers show

Comments

Jan Kara - Feb. 25, 2013, 3:55 p.m.
parse_num_blocks2() wrongly did:
	num << 1;
when log_block_size < 0. That is obviously wrong as such statement has
no effect (and the compiler properly warns about it). Callers expect
returned value to be in bytes when log_block_size < 0 so fix the
statement accordingly.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 lib/e2p/parse_num.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Theodore Ts'o - March 1, 2013, 1:13 a.m.
On Mon, Feb 25, 2013 at 05:55:05AM -0000, Jan Kara wrote:
> parse_num_blocks2() wrongly did:
> 	num << 1;
> when log_block_size < 0. That is obviously wrong as such statement has
> no effect (and the compiler properly warns about it). Callers expect
> returned value to be in bytes when log_block_size < 0 so fix the
> statement accordingly.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/lib/e2p/parse_num.c b/lib/e2p/parse_num.c
index cb0dc5b..e8d6283 100644
--- a/lib/e2p/parse_num.c
+++ b/lib/e2p/parse_num.c
@@ -42,7 +42,7 @@  unsigned long long parse_num_blocks2(const char *arg, int log_block_size)
 		break;
 	case 's':
 		if (log_block_size < 0)
-			num << 1;
+			num <<= 9;
 		else
 			num >>= (1+log_block_size);
 		break;