Fixing the bug pointed out by Andrew Morton, shift loff_t instead of
sector_t since sector_t may be 32-bit.

Signed-off-by: J. R. Okajima <[email protected]>
---
 drivers/block/loop.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index fcd28a7..eaed1fa 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1171,7 +1171,9 @@ static int loop_set_capacity(struct loop_device *lo, 
struct block_device *bdev)
        if (unlikely(err))
                goto out;
        sec = get_capacity(lo->lo_disk);
-       sz = sec << 9;
+       /* the width of sector_t may be narrow for bit-shift */
+       sz = sec;
+       sz <<= 9;
        mutex_lock(&bdev->bd_mutex);
        bd_set_size(bdev, sz);
        mutex_unlock(&bdev->bd_mutex);
-- 
1.5.5.4.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to