Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp323249lqb; Thu, 29 Feb 2024 01:52:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXaaM1Pku4/H7skMaa2/zlW9xN9WBaKmBheUzjSiXHD/ZJSFWi6gyU8pjcGtut3oxY04YBj8Tp7w75EFtywknaJwq179Qe7PvJFNvUKTw== X-Google-Smtp-Source: AGHT+IHKJXmD19qG2vx7MhBnnWIuL0hL3FUlvIj8+zUtl6q2U2tgP3DHwFhiKeXRCUWJ8d40xfeZ X-Received: by 2002:a05:6a20:9591:b0:1a0:d57b:1c93 with SMTP id iu17-20020a056a20959100b001a0d57b1c93mr1869019pzb.33.1709200332708; Thu, 29 Feb 2024 01:52:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709200332; cv=pass; d=google.com; s=arc-20160816; b=qptG7RmisbiwlcnF8HL2PTJa6V6m01ZLr+oupKb/Q/8HZWLWrnQrFLfPEYRRXNjwke agNLqT7RV9PVXz5PlOL93Mt4zgOmo1XKLSrH2bslTLVDNHWLSpqDQ8QUEVRCmFUS41bq KUb4AlCl+pjoW9NcVAXqRpfCfW3WwZVkVLJXqdnwaEXnGpUKY/xwwN/F1m8zsa/bLT/O JjT4CJn6gDgYu+SdjemKUcQ+oGqEyHDCY9mFP5zHjNUHDYT8/EYwGCCDheasK255h0Lr hPumaVsVFBXIfbPtllNv3Ycxxqio7KA7CWrUB5iEA3iW1huqjQICg7qC6KWJzBMtMTCB BUGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=28mM1L7VoPpQ2Bxti5OxSfSjhM5DSY0iAhB3xAG9DsE=; fh=EvLWc2r8Rx1LBrXB2M+bGi8FX8z9/YzSTJ47CJeltA0=; b=xc2d20p5kdg9zHRAIKakSI8NiCsG5uRAuBlpbz9l1mt1QETT6ZSvJi6h/DS0xlXW36 bOCowSIuCDlx77z3RTOBk0rctSvBH6VhV5HXsCGUkaw/EgoV3EKjr/jFLV4//Q40xfBn za1G+S4ASO43jX4SF0uUkjjLKQBtyewJy8WJqVeI/fHG0u/MQMtKkc6IXQpmHOobYzVo d+jHzY1ToiG+sa5in5+mpUYHbYxHF4YaLF0kaizcRLnjgdMYhH7Jm3in9EAqAHXPj5aB L1f45s1UZD+8tsF4GMGNLQh9nIyXnA5FRbfy9GpYQVx99TWEOLTn/4ShBKRriJ3Lbe8L ULCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=vhUfu7Uk; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-82879-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82879-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z6-20020a170902d54600b001dbd8225034si1062178plf.590.2024.02.29.01.52.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 01:52:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82879-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@pankajraghav.com header.s=MBO0001 header.b=vhUfu7Uk; arc=pass (i=1 spf=pass spfdomain=pankajraghav.com dkim=pass dkdomain=pankajraghav.com); spf=pass (google.com: domain of linux-kernel+bounces-82879-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82879-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 96120284E28 for ; Tue, 27 Feb 2024 08:45:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28481130E48; Tue, 27 Feb 2024 08:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b="vhUfu7Uk" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (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 B07987E761; Tue, 27 Feb 2024 08:44:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709023496; cv=none; b=eHfPCoHJTsexPDx1UVGSpRMxMKW1qVRFI/WTrAHZPJ0nd4kytGyfO/lNze+1LT/ZNXpkHp2I5mHU3m9hIyFMzg+e+NjcMYWqqXDneoNo6p7tEMt2CzLSii3lLnn5L+/mzwKuSVqQxkX2LPfl++kjkam6oQqPK/QEn2ECDxsXvO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709023496; c=relaxed/simple; bh=F6Dw1yhuXSn9tDcHzMLVsOx+fa7VDnyjl31zCJLzb7I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uoHJqNXk7EYHVbCnTFQI5N+7PCsm1h7a7z0BTKFxPuEIVjsLquxVUs0dhN+fxL0OOCm7fgbuj7JRYaoN7q2je+dojuH0tDjn1EI7+goVXGMWMzzFbEfXaPhF65zh9uYTKHzNLcbwh+p6CvqDpPBrcKFQHPMvcZIxSgZD9MZkgT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pankajraghav.com; spf=pass smtp.mailfrom=pankajraghav.com; dkim=pass (2048-bit key) header.d=pankajraghav.com header.i=@pankajraghav.com header.b=vhUfu7Uk; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pankajraghav.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TkWJL6wn2z9t0M; Tue, 27 Feb 2024 09:44:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1709023491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=28mM1L7VoPpQ2Bxti5OxSfSjhM5DSY0iAhB3xAG9DsE=; b=vhUfu7Ukkzc0sJ3NR4BGYejf5reNNcHuMppL3CH2U9H7P/14zED8PWIe58sugXnGExZkI8 yWE9fwlD0rlXjqEW4HgHb1ItUC84CCTD2HKudIo/vn1WQs2xO4gDIQVTcUXPpW4nwpdQY6 RiKmh/OvoFKM7M0FnU/Nyw4HAGNa4lHRCiDRD4mRBdQNNRCNX1q2B0vaSi8nehFSqKLoWr kScyJxMdKaa0STuFn5cqUJDhIdUsjXjV2q/qDojeo8kXV6/WwDgUc7JXWz4FlO2bAQWBHe BFikc0eFXVid62NyhvTPH4xx3QiyPOSeWygvw5gXSH9O8iqdS9vtJ4DH/jzjUA== Date: Tue, 27 Feb 2024 09:44:46 +0100 From: "Pankaj Raghav (Samsung)" To: Matthew Wilcox Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, ziy@nvidia.com, hare@suse.de, djwong@kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, Pankaj Raghav Subject: Re: [PATCH 12/13] xfs: make the calculation generic in xfs_sb_validate_fsb_count() Message-ID: References: <20240226094936.2677493-1-kernel@pankajraghav.com> <20240226094936.2677493-13-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: X-Rspamd-Queue-Id: 4TkWJL6wn2z9t0M On Mon, Feb 26, 2024 at 01:21:56PM +0000, Matthew Wilcox wrote: > On Mon, Feb 26, 2024 at 10:49:35AM +0100, Pankaj Raghav (Samsung) wrote: > > + if (check_mul_overflow(nblocks, (1 << sbp->sb_blocklog), &bytes)) > > Why would you not use check_shl_overflow()? This looks better than check_mul_overflow. I will use this in the next version. > > > + return -EFBIG; > > + > > + mapping_count = bytes >> PAGE_SHIFT; > > /* Limited by ULONG_MAX of page cache index */ > > - if (nblocks >> (PAGE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) > > + if (mapping_count > ULONG_MAX) > > return -EFBIG; > > return 0; > > } > > -- > > 2.43.0 > >