From: Daniel Rosenberg Date: Wed, 21 Jun 2017 00:05:33 +0000 (-0700) Subject: ANDROID: squashfs: Fix signed division issue X-Git-Tag: release-20171130_firefly~4^2~100^2~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2d616f8ceaf68c68c123590ad75839efaaa232a4;p=firefly-linux-kernel-4.4.55.git ANDROID: squashfs: Fix signed division issue The value here can change depending on the type that PAGE_SIZE has on a given architecture. To avoid the ensuing signed and unsigned division conversions, we shift instead using PAGE_SHIFT Signed-off-by: Daniel Rosenberg Bug: 35257858 Change-Id: I132cae93abea39390c3f0f91a4b2e026e97ed4c7 --- diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 2eb66decc5ab..4e3e0863f5ea 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c @@ -211,8 +211,8 @@ static int bh_is_optional(struct squashfs_read_request *req, int idx) int start_idx, end_idx; struct squashfs_sb_info *msblk = req->sb->s_fs_info; - start_idx = (idx * msblk->devblksize - req->offset) / PAGE_CACHE_SIZE; - end_idx = ((idx + 1) * msblk->devblksize - req->offset + 1) / PAGE_CACHE_SIZE; + start_idx = (idx * msblk->devblksize - req->offset) >> PAGE_SHIFT; + end_idx = ((idx + 1) * msblk->devblksize - req->offset + 1) >> PAGE_SHIFT; if (start_idx >= req->output->pages) return 1; if (start_idx < 0)