Received: by 2002:a05:7208:c250:b0:86:f851:443 with SMTP id w16csp938847rbd; Thu, 13 Jun 2024 01:47:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVil/o9juH6JCyrgM0HqrvP5gXbL8SDAgTOOhgUMShbpjcZWTplbVj7sHTqwQw6v6FQz6Zjm4o+eMjNYRAg77vdVbu218NLY8CeKni0fA== X-Google-Smtp-Source: AGHT+IH2uR15ZgC/SKlo6ej6JTBXOXMqic2SZqayRYm17wi/8Nh0GodUfdjCwJckhIR+rR+O5iZH X-Received: by 2002:a17:906:351b:b0:a6e:f8dd:d2fd with SMTP id a640c23a62f3a-a6f47f7fdbcmr261506266b.29.1718268425640; Thu, 13 Jun 2024 01:47:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718268425; cv=pass; d=google.com; s=arc-20160816; b=W4azrR0NvxcnMgvsy3beIfmwysW6T/R7eITNyZA/bYG1ZvbxavsvizQXwxn9Vipq0Y RFHrHyoJpkfmt8plTnhvV7vc2eS5Hg96nfOXw1s64WMT1as9hoZIiP/X1hajosWpXA7l y7hswaxPPQkyJx83HI3GJZmoQHsqp4ZjwZeAvUU751rOSeSyCFnv6sdPOy4IsL6gkITM iAVeuRVvcMCXMwUn32SV/Uq/L5LAGpkH+TvIVVHLN4BPpiy2xOg2R9w433YvcPdFJXOB PUKltJu4t3wHicJLBX3PcDik2OeOX2K51YoOKlbKz78xuHkk4XPVgv4MzYsZw8+hNpky yy8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=WatYazhebbGpDvVUTPW79qvRKhIIqIGgORRZr4O4Vks=; fh=WY+EXP+0Z/8nNJlQuRNcCQoLfef3+UXTTkI4wdoTqXM=; b=ehnvIUCJTHGy+ptSm6bbrxoE9rF4SZX1zjEyVDVhCKI/Ed5plQ+v/MsMyhOwcUoNKx JW0DYkW8FB5tyw39oVvrHmuh9B2Q24PoQCN41cBnHVO/6JfYgEZqZU4xNyt6eZEFuRTb xjRKNTvwtCWea5pdNdk82dkxXmZ6flU32TlW/MUf7AOFFycHf0r9U4/x8MUNjxCLZjDc /HbI1Y2HFZeNniu99AL5hs2rOXKttaR+ajiG8KUAJEK/FQp79jc3ljSKRpguN5rXJQC6 GDCS7kHz72Nv9By0zh4hXttdBIY+9gJk7jZo5/fBAR1M1W1bN3EawQ24AYZx+EWVWBE3 cuhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-212864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212864-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56e26ac1si45627266b.738.2024.06.13.01.47.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 01:47:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-212864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212864-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6681C1F21B13 for ; Thu, 13 Jun 2024 08:47:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25C1D13E04A; Thu, 13 Jun 2024 08:45:52 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DFEF28F1; Thu, 13 Jun 2024 08:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718268351; cv=none; b=RZpIU125593On7xZ7WTTlVt4JTHMbyQ/YXYV/UcSjKxjRKBI/ucNsSwPejsxoRGEkM1l0UKBl0+Z2dyvMXQ5q5ep0fkIW++25pjkMpvcuFOpSm66qFEWO+w8r1mQzKPTlrA4IS0YrOk2lyD9scATh8faxQinJWV2XWhSMrXbAgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718268351; c=relaxed/simple; bh=pd9icyH3HrNnyeWi69GOzEN/1vvh5EWir/kOPt6/4wM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a7OBYADKfKi67QZE55nH1MwQrXNdW9rTKZdBfN1ZpP7+Gv4PAm/nEBVWojSu2etdcFpK8kPjcjzUl08J1dYLAvTLRqM73ZfArkFrC5A1jRX1DRRTvQ/AwDVt5TY8zAkU+7nGjSgv5sP+B1m7eXC7U+hIRDpkhOIaI7ixRHe42ok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 9417068BEB; Thu, 13 Jun 2024 10:45:46 +0200 (CEST) Date: Thu, 13 Jun 2024 10:45:45 +0200 From: Christoph Hellwig To: "Pankaj Raghav (Samsung)" Cc: david@fromorbit.com, djwong@kernel.org, chandan.babu@oracle.com, brauner@kernel.org, akpm@linux-foundation.org, willy@infradead.org, mcgrof@kernel.org, linux-mm@kvack.org, hare@suse.de, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, Zi Yan , linux-xfs@vger.kernel.org, p.raghav@samsung.com, linux-fsdevel@vger.kernel.org, hch@lst.de, gost.dev@samsung.com, cl@os.amperecomputing.com, john.g.garry@oracle.com Subject: Re: [PATCH v7 10/11] xfs: make the calculation generic in xfs_sb_validate_fsb_count() Message-ID: <20240613084545.GB23371@lst.de> References: <20240607145902.1137853-1-kernel@pankajraghav.com> <20240607145902.1137853-11-kernel@pankajraghav.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240607145902.1137853-11-kernel@pankajraghav.com> User-Agent: Mutt/1.5.17 (2007-11-01) > + uint64_t max_index; > + uint64_t max_bytes; > + > ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); > ASSERT(sbp->sb_blocklog >= BBSHIFT); > > + if (check_shl_overflow(nblocks, sbp->sb_blocklog, &max_bytes)) > + return -EFBIG; > + > /* Limited by ULONG_MAX of page cache index */ > - if (nblocks >> (PAGE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) > + max_index = max_bytes >> PAGE_SHIFT; > + > + if (max_index > ULONG_MAX) Do we really need the max_index variable for a single user here? Or do you plan to add more uses of it later (can't really think of one though)?