Re: [PATCH 1/3] zram: fix operator precedence to get offset

Sergey Senozhatsky
2017-04-14T05:07:49Z

Hello,

On (04/13/17 09:17), Minchan Kim wrote:
[..]
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 9e2199060040..83c38a123242 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -930,7 +930,7 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector,
> }
>
> index = sector >> SECTORS_PER_PAGE_SHIFT;
> - offset = sector & (SECTORS_PER_PAGE - 1) << SECTOR_SHIFT;
> + offset = (sector & (SECTORS_PER_PAGE - 1)) << SECTOR_SHIFT;

sorry, can it actually produce different results?

-ss