Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp523671pxx; Mon, 26 Oct 2020 14:11:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCEvx+HwyEdVqa/+b29KqfZC6p7RDv5BhA1wih9MVZtQ9Z381uDqDqJisrNcLjh3cD5tXO X-Received: by 2002:a17:906:a119:: with SMTP id t25mr18662443ejy.67.1603746705018; Mon, 26 Oct 2020 14:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603746705; cv=none; d=google.com; s=arc-20160816; b=q8ixKilhIOMJ1cr5LMddVeXpFwdDalyXMuS81ANWoeMNHRg/6Q7fJ4k4R86bjofG6d Yvt5C5o5dCyZrchxsBfH3gOxD63GJM5GdTAgbiA0py5d0WzilTxHmo6/LExab4VcQI0E TzgJ+YZAqxxojcyMehXaclqtA+0IygG1Flhk9hYEIaOj9nB9pPjEFMF+JQklGOiIPUfw fnI1UANOGnGYhhujI6sjJAWAoAdEc/QHMahlK+ut1BW7+LyWCnTjuz9fNWM/Cg+1cv1e At6WoaGm8vcVbm79+S4n6ak03k1PWnjThaybnwXPT+Tbf7QVOWtr4MShrmIXoWTjP7vk hAJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date; bh=NmduY/I6hUkoR3yPeckwm6z7AHf++wIPzuR2SPFL5Ag=; b=U9npkp1wdxIXOKzsQ6msZDYOFNUhpzM6DDPT+wxbRU0V7R+Hbvg6YY3c9DvNHSBUev VLoo4hjraKemvKSnX59TkS/189fyCcChX3KeZTUkSflFxIQBylYGA8Eb0PzwXzX3if0E vGbU6vHxNTN1JdDjXHx4jbA+UZFmIo2E3bh1OKBKdeAy87fl6lXknX9heuPNo9fckKhg KqMdq8UKr7SCZjnCLtt8PQoxJEq/MHWUXMMidjaL+HLhbRBVZMAmwYS74OmPiBpC68PV LpvufxqKxqIdLKr3hGuG7CK+hK8cs+fpvqwC6Zc0ABdoUK1+1eYvfuZIw3FN2NzyS6w7 fV4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lf22si8016922ejb.20.2020.10.26.14.11.19; Mon, 26 Oct 2020 14:11:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1786147AbgJZQhY (ORCPT + 99 others); Mon, 26 Oct 2020 12:37:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:60662 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1738342AbgJZQhW (ORCPT ); Mon, 26 Oct 2020 12:37:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 12AF3AD52; Mon, 26 Oct 2020 16:37:21 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 07BA3DA6E2; Mon, 26 Oct 2020 17:35:46 +0100 (CET) Date: Mon, 26 Oct 2020 17:35:46 +0100 From: David Sterba To: "Matthew Wilcox (Oracle)" Cc: linux-fsdevel@vger.kernel.org, ericvh@gmail.com, lucho@ionkov.net, viro@zeniv.linux.org.uk, jlayton@kernel.org, idryomov@gmail.com, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-btrfs@vger.kernel.org, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, stable@vger.kernel.org Subject: Re: [PATCH 6/7] btrfs: Promote to unsigned long long before shifting Message-ID: <20201026163546.GP6756@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, ericvh@gmail.com, lucho@ionkov.net, viro@zeniv.linux.org.uk, jlayton@kernel.org, idryomov@gmail.com, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-btrfs@vger.kernel.org, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, stable@vger.kernel.org References: <20201004180428.14494-1-willy@infradead.org> <20201004180428.14494-7-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201004180428.14494-7-willy@infradead.org> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 04, 2020 at 07:04:27PM +0100, Matthew Wilcox (Oracle) wrote: > On 32-bit systems, this shift will overflow for files larger than 4GB. > > Cc: stable@vger.kernel.org > Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6") > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/btrfs/raid56.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c > index 255490f42b5d..5ee0a53301bd 100644 > --- a/fs/btrfs/raid56.c > +++ b/fs/btrfs/raid56.c > @@ -1089,7 +1089,7 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio, > u64 disk_start; > > stripe = &rbio->bbio->stripes[stripe_nr]; > - disk_start = stripe->physical + (page_index << PAGE_SHIFT); > + disk_start = stripe->physical + ((loff_t)page_index << PAGE_SHIFT); It seems that this patch is mechanical replacement. If you check the callers, the page_index is passed from an int that iterates over bits set in an unsigned long (bitmap). The result won't overflow.