Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1909724rwl; Wed, 12 Apr 2023 21:52:32 -0700 (PDT) X-Google-Smtp-Source: AKy350Z2VXekskTWjyvCSLw6adlOhLaW1yqEBNDDanDmr2usZ+DoHQxtOCfffHlVTNF9JzWCWXqf X-Received: by 2002:a17:906:edd9:b0:947:72bd:f72a with SMTP id sb25-20020a170906edd900b0094772bdf72amr1140078ejb.72.1681361551816; Wed, 12 Apr 2023 21:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681361551; cv=none; d=google.com; s=arc-20160816; b=OsQrmdrhs7ZlwcSpBZTgVgYvbvPp8/s2jZKWERa8knjah7z+e4KtwwG5TaZcreMiSK 5xX5sarTq3EHqOgbr+/BPxN+C46Nd/NEYIdmZNpCTrmWlRg9WYb0IDkVJ7QUreVPkhqU GUvF5VvSZnD9EcAwHDEVW3YLrn+zvi9CydI6zoDsN2GtEVVuEjv4MO6Za45Ss7X7WkF1 9ncfuic8FkAkYlyk4LRqeW5QPmHESC1gO5vcGWAcN37hVjdPwjK+uahmVlWRNc7rf1PJ MDLmm3aPvCJsp6+Q0x/rxvlbZSJsygF1+LCijuv/M+/UTmmqi/pcEI5bSTfFQ+VDYJaH CvOw== 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:subject:user-agent:mime-version:date:message-id; bh=ocvsFxyDzXdRe/aoYtp81dGpLf9oFrLHafkOf3Ye1yI=; b=c01QU9mFJgjdFWyuy+H3jLRT6Hr5DOEDSgymoiIwwjyBP2o8e8LsvQUFQ6Qc1aHJmR g4yGH/I8mE0pcp2/o/Cdc3qE+FcPwd1QPfLjyiDwvc8Hpd3jdfIjZcPt7GzhMn/igZC2 ksLPBARcNK1wUOJOSByAcNifLqS4I287guR9f8rfetkVZun4MmiIuXp51d/GnYIyS/Mo aaTLcvN17NCWh6dxekJJGI2oEYUcdyRa1e9PNNQkN6dp8+sGjVRBEDFQTJhU4aceppqG YhXUaRFo3DE16an7JfXpAI0pXHJpdTzmo9y123WG+oJdZi7FPmJj0+7MX0FadWPJPN7l k9eQ== 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 up15-20020a170907cc8f00b0094e55ac58b0si792963ejc.972.2023.04.12.21.52.07; Wed, 12 Apr 2023 21:52:31 -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 S229560AbjDMEgg (ORCPT + 99 others); Thu, 13 Apr 2023 00:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjDMEge (ORCPT ); Thu, 13 Apr 2023 00:36:34 -0400 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F073C39 for ; Wed, 12 Apr 2023 21:36:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R841e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VfzAjd0_1681360590; Received: from 30.97.49.11(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VfzAjd0_1681360590) by smtp.aliyun-inc.com; Thu, 13 Apr 2023 12:36:30 +0800 Message-ID: <9687e2ce-e0ba-da9e-7b20-d83c56b156c8@linux.alibaba.com> Date: Thu, 13 Apr 2023 12:36:29 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] erofs: explicit cast blkaddr to u64 before shift operation To: Jia Zhu , linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jefflexu@linux.alibaba.com, yinxin.x@bytedance.com, xiang@kernel.org References: <20230413035734.15457-1-zhujia.zj@bytedance.com> From: Gao Xiang In-Reply-To: <20230413035734.15457-1-zhujia.zj@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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, RCVD_IN_MSPIKE_H2,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 2023/4/13 11:57, 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 Reviewed-by: Gao Xiang Let's fold it into the original patch. Thanks, Gao Xiang > --- > 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;