Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1868593rwl; Wed, 12 Apr 2023 21:00:22 -0700 (PDT) X-Google-Smtp-Source: AKy350b4QepQqJurmBDqb920yN5XWWh8vcHb+W6CsOlkLd/Y/bDak8FXJJtHmspboJr8Zd9vDyOv X-Received: by 2002:a17:906:8548:b0:94a:5402:da29 with SMTP id h8-20020a170906854800b0094a5402da29mr1120526ejy.19.1681358422299; Wed, 12 Apr 2023 21:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681358422; cv=none; d=google.com; s=arc-20160816; b=CJcH97D+MOg7PEMjIZ9EEyhVuHDSLCVGA92asKNlngPu+nap0T+JPO4sh6YRiJq+xG hvimWS+Yeug44AoiQivY4T4jtoJKkgO4IQSLrrWHMqe6P2hwLHy89ggSkt+aWtJI2VX/ ANQpLw6QuCx+3RR9YJqHgYUbBppRcQQWwt83sp8d17o1YNoKpSHmYtIr1B0T6vn/hdV1 bGD2B2rzR7zeqosjpxeBLQLD0h0VV6YV6H1I07nLFzEwalZQ01+ixQRDVNjgCyvx/ttc V6DhdFLimeEJ9YlcRatQaWsVMglXxZs9mAWJdM7xE6XtGtjY+mt/USZxk9yw6SqV1B16 kBMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YJGRTZkA5BN2qD8Z6WUNMxuaviulFYl0QBBAj8i8gIc=; b=i68rzn2nVaDkoua68tE8wnOU5/8yybLdSQUiovaZsLRqnCUujLttDcqOsY2w1GuhYL pAUK49UeqwCbKQrtd9VptOLwNCCoFmkLcyDnOWmBaP8976rSknfCybP/uipL+YMCaAPT oWIDKIPD8Q7NmBlwajWjYf6aFw2T1gfjAbyw/XhoPjfL0ky2yENb544pel/z14gkhWAb IIQ97UNT1v+D5jsbZR5j3xBKeK3bU3rpjc2nPtSqMT/9an99jko3Y0oXtR43wfryu/sa wqMLfI+ZjtbJtRBuAvA0zgotFBEKu/SY5HgtHxvqwruA6v1Wdi3iG4B8qfRyREnorQTn RqgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=XGmPAZ2R; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a170906a10800b0094e9865c092si733034ejy.714.2023.04.12.20.59.57; Wed, 12 Apr 2023 21:00:22 -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; dkim=pass header.i=@bytedance.com header.s=google header.b=XGmPAZ2R; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229571AbjDMD7E (ORCPT + 99 others); Wed, 12 Apr 2023 23:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjDMD7A (ORCPT ); Wed, 12 Apr 2023 23:59:00 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 214F940F4 for ; Wed, 12 Apr 2023 20:57:59 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id j8so12275041pjy.4 for ; Wed, 12 Apr 2023 20:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1681358278; x=1683950278; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YJGRTZkA5BN2qD8Z6WUNMxuaviulFYl0QBBAj8i8gIc=; b=XGmPAZ2RAQ9Ik5StN07HIt6NRnh/K6LU4Rz7k7zpLK/KNy2A2ErXBWQqJN/7NQQMkT KYvRdP2QtEJ8ux/sw6j3Pt7TtnaPILyv3+GuX55N9l7QtZ1/YgQ29x7XTSMO0VxhMajA boEAtNI/WRhO3eB3Sa18eQao0Py68SMxWWcqQlzPefENA25gLeVp/d4RsSe3aW4P16AW yN3yxW/m6BcbvyHeow9+/ilX+tlvQvFNeimSq5+2FSJpv4nbejAYFcj7phCbDjBNCGd4 PPIx6QPbsgeJm6vk22FFbY5ogKiXPppV103Vs8GCO+bdBp5yPMWZ2Zv3s6tjqsqgisBA pwLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681358278; x=1683950278; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YJGRTZkA5BN2qD8Z6WUNMxuaviulFYl0QBBAj8i8gIc=; b=R7gtiLganlFNeaqAGeZ1PdG1p0dYJ87PruYmhMXN+o9TMsT0pSxlQL1c1l4GeYU3J5 WrG+eo+x04rgsSVVGL0GS6QzuBDvFtQ0GOgAgfInNxXZtj0pViApevjwLZcfIA6aX4X1 AiE+G8Mewqr6YtQvcZYLJw0uKWDJFQdzTBQ2r9rEkuJcMcGvejmK8jRbOmvayK1KAtVF 64LJ8eW2MGUW/xIT8Ic/NssPiKjHI6Bb9rDGaj7JcGZRJzv5XV5+MvpsJac72vnhHvj4 ZaNXVQbRU+qjfFvJrqDYfdzfwSsUcFz3qD7bPIDFqoF9mjgp1qKiI9xfxOhR/3kR7pHB asiQ== X-Gm-Message-State: AAQBX9dX76cxiKFCcb8M3S/KNFtwgE0FcrUqE1u9BDTDCCSZNhtE5DaM xXbn2tPa5nsC/54T8CELwkwITQ== X-Received: by 2002:a17:902:e842:b0:1a6:7570:5370 with SMTP id t2-20020a170902e84200b001a675705370mr837413plg.10.1681358277944; Wed, 12 Apr 2023 20:57:57 -0700 (PDT) Received: from C02G705SMD6V.bytedance.net ([61.213.176.14]) by smtp.gmail.com with ESMTPSA id p3-20020a170902b08300b001a2806ae2f7sm359069plr.83.2023.04.12.20.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 20:57:57 -0700 (PDT) From: Jia Zhu To: linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, jefflexu@linux.alibaba.com, yinxin.x@bytedance.com, xiang@kernel.org, Jia Zhu Subject: [PATCH] erofs: explicit cast blkaddr to u64 before shift operation Date: Thu, 13 Apr 2023 11:57:34 +0800 Message-Id: <20230413035734.15457-1-zhujia.zj@bytedance.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 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; -- 2.20.1