[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c12b5de6-9591-56ba-85e6-e6292aece7bd@linux.alibaba.com>
Date: Thu, 13 Apr 2023 12:27:16 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: Jia Zhu <zhujia.zj@...edance.com>, linux-erofs@...ts.ozlabs.org
Cc: linux-kernel@...r.kernel.org, yinxin.x@...edance.com,
xiang@...nel.org
Subject: Re: [PATCH] erofs: explicit cast blkaddr to u64 before shift
operation
On 4/13/23 11:57 AM, Jia Zhu wrote:
> We should explicitly cast @blkaddr from u32 to u64 before the shift
> operation to return the larger type.
>
> Fixes: b1c2d99b18ff ("erofs: avoid hardcoded blocksize for subpage block support")
> Signed-off-by: Jia Zhu <zhujia.zj@...edance.com>
> ---
> fs/erofs/data.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/erofs/data.c b/fs/erofs/data.c
> index aa7f9e4f86fb..6fe9a779fa91 100644
> --- a/fs/erofs/data.c
> +++ b/fs/erofs/data.c
> @@ -35,7 +35,7 @@ void *erofs_bread(struct erofs_buf *buf, erofs_blk_t blkaddr,
> enum erofs_kmap_type type)
> {
> struct inode *inode = buf->inode;
> - erofs_off_t offset = blkaddr << inode->i_blkbits;
> + erofs_off_t offset = (erofs_off_t)blkaddr << inode->i_blkbits;
> pgoff_t index = offset >> PAGE_SHIFT;
> struct page *page = buf->page;
> struct folio *folio;
LGTM. Thanks for catching this.
Reviewed-by: Jingbo Xu <jefflexu@...ux.alibaba.com>
--
Thanks,
Jingbo
Powered by blists - more mailing lists