[PATCH] Fix accepting invalid block size

Roi Dayan <[email protected]> Tue, 26 Jul 2016 14:06:32 +0300
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
bshift can be negative so its type should not be unsigned or the
comparison of its negative never succeeds.

Signed-off-by: Roi Dayan <[email protected]>
---
 usr/target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/target.c b/usr/target.c
index 6dce46b..f109f17 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -611,7 +611,7 @@ tgtadm_err tgt_device_create(int tid, int dev_type, uint64_t lun, char *params,
 	lu->blk_shift = 0;
 	if (blocksize) {
 		unsigned int bsize;
-		unsigned int bshift;
+		int bshift;
 
 		dprintf("blocksize=%s\n", blocksize);
 		bsize = strtoul(blocksize, NULL, 0);
-- 
1.8.4.3