Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1891460rwl; Wed, 12 Apr 2023 21:29:41 -0700 (PDT) X-Google-Smtp-Source: AKy350ZOGMwoswA5n83Gdsv/qTXJ3V5GKss8dYF96r8dwZ0C+ZOEsyiNGh4mxWFifJ7aCxGys8BK X-Received: by 2002:a05:6a00:2d9d:b0:63b:19a8:51ae with SMTP id fb29-20020a056a002d9d00b0063b19a851aemr5096972pfb.9.1681360181455; Wed, 12 Apr 2023 21:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681360181; cv=none; d=google.com; s=arc-20160816; b=eOEtX5OfUGy7WuDe+wLGKoyMVEzzn0ClIk9VllcGOyMIecwwDuMPTBTINQTFmKHtXD pLheY0AKRi+SyrvVi/fDdLYb+ZwuMP3bhBZOVWtWec3N5rCo7b1+KtiKrnJngIOjJyLq 1xBC+7r+YrWxU8EgV++sMtiR8rFUFhYYPocOopNzGuThZmeqFcjko8/N+5lGbChWdOJw BxkkPqeR6HYMFcAGeFXnXMp0aXEjZ0um9CeGglC7Ghl22Bu+kH7ya2aF2YEHqjckOxfH iTMcmOgHC3qgoX48YkYPHrQD695yK0tCSMRuCzQlN+1JU2uAZbl7vWOW8cVUMWbpaU72 cNAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=0K/GwqElh3S+jAU7yUADkG55uHMOj7wVSy6DLRLhk6w=; b=phTKrwVC3/oCXzY+1tEz72M2HPaQUKjoUetM/RXbWWDrazSspb7pePk7+GGL2YjB9H bTS7WgRYBWERieDqNdQSL2roE05X7n1p0hpBNV4qNKMvOtauGyYxk1e3nAKofYmnv560 5R61dvuHxKsmwjxgjbbsRUdBpLeM26fTOCit98TZbSR/1nH5W5MpEaLBlNra8xZs9hGE 5tnyE1KA4sXEJPpmenYMdsXF0ogqjmub/8R2p/vs3EZc3qrKZsV82bLIsWFFu50P+gqt 7JyvPk1qwg1gFfWyjE3NHAGn+pGYNZKstz9/3jDyJT4UKRNmS7KraKP9MO/RQHdc7AgH mw/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w27-20020a63475b000000b0051ace49decbsi953593pgk.769.2023.04.12.21.29.29; Wed, 12 Apr 2023 21:29:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbjDME1W (ORCPT + 99 others); Thu, 13 Apr 2023 00:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjDME1U (ORCPT ); Thu, 13 Apr 2023 00:27:20 -0400 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2AA2170F for ; Wed, 12 Apr 2023 21:27:19 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VfzAfT2_1681360036; Received: from 30.221.133.131(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VfzAfT2_1681360036) by smtp.aliyun-inc.com; Thu, 13 Apr 2023 12:27:17 +0800 Message-ID: Date: Thu, 13 Apr 2023 12:27:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] erofs: explicit cast blkaddr to u64 before shift operation Content-Language: en-US To: Jia Zhu , linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, yinxin.x@bytedance.com, xiang@kernel.org References: <20230413035734.15457-1-zhujia.zj@bytedance.com> From: Jingbo Xu In-Reply-To: <20230413035734.15457-1-zhujia.zj@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 -- Thanks, Jingbo