Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1409078rbb; Mon, 26 Feb 2024 08:22:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXj0lMQ/wze228X8PRfJ2UBEzmuAeaz7pQJWlNRarvMlOsT+rmf2/MItjmbNxvPiMNtXGnIBtk4d5sVyFyp/7qIhtoLmBn2yxcZTzBUzQ== X-Google-Smtp-Source: AGHT+IETp1vHk7El8YgNL+BlazncYdyTPR2g48lFTMrqEA3cH18cHbOZfvR0jmI7m9WhsEi6XpGm X-Received: by 2002:ac2:5fd0:0:b0:512:c985:4890 with SMTP id q16-20020ac25fd0000000b00512c9854890mr4393272lfg.67.1708964533164; Mon, 26 Feb 2024 08:22:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708964533; cv=pass; d=google.com; s=arc-20160816; b=ycG1SMY1zkLScBALW7bJGHV8+zyY3mdcqjGnKzwivfySaM7fNePY19qyG4QWmiysw+ bboL5po0vKFoCVIgxlRVgNflE2JmJO2jJAZcnD+6U6FP8W0WP9Ed3NAeNI94ShXowmkF cbSEecFHqG265XZn7T0LJtN3LcOrWmwkcAHsMoRsLfUrhBHcnjNIKzfg8srdo7NtjgMv 1pQTCSwY/YZK8qm/vt0+/60yAX7rvvjNo7T7AcPF5MsKUZsIEQ7yuXAfdtDhJjYHSySk 5mApnpFWhie1b8eoV94Eo5ABKCkYuJYzxn1vztK98jlbkFtDd7fN0/i4tujlDmHT7Nxz F4vA== 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=FOEO53PWfz8jVV9tqBTYQ+FUQRTS1bvm3k8jdLn41jA=; fh=IrswWLQdr8RUReWLOUl6bTv3Gs7y0bSQu4ieH1tZUiQ=; b=AQ5QqLfeaBQBLflIEL0jKxYUMJ5al0aa1O7v1LWVQ4ozC/SrIxtSUZrVXpLJK8mSU6 lk5L66aZWK01fb1Yoa7CG4CCzx0rqYo6KgnTam9ksICt+MqrQV1uPF+32ZxVpIWWte2T h1fatEuU7/yzeWg86z0bFjUqN8n0SIicXwwyTp463OmV7GPauV1yyexFaBG3IyrrnPGY T98++UBnUySetQY0RBLUMOB3g25enXZHxjlac0SMTaSmgSTzxO5FOH1ave4mFIKpTbNH YbPJEAx0fwv2bPu+NyyZFWfgUTz8Ox+uLkhWjDlEEENNdArbzJCWUW6HhEeM8uWkdfBI 1pUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OQr75EHy; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-81471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81471-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a22-20020a170906469600b00a438fc5c03esi150411ejr.970.2024.02.26.08.22.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 08:22:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OQr75EHy; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-81471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81471-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 0A40B1F24638 for ; Mon, 26 Feb 2024 13:22:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53DBE128360; Mon, 26 Feb 2024 13:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OQr75EHy" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 02DD6604B7; Mon, 26 Feb 2024 13:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953722; cv=none; b=h+AnfZ6dFeiCqzc0CoqDOauYBGvePbRkdHAjQ4y4umhD4xI5V2+mmFbaNu144pWg4TG8w3U43COhxDlmhUnm8vAKhdJaL/bymZb+UlGvHEFZqAVVA2VqWgX3GY4Q2Hh8rZs2IbpGWav3IDMZeIn+aM67YtSTObmZoaEJimhApRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708953722; c=relaxed/simple; bh=R7d2acqprmU8yb3JpCgLFrgbVNL0FKm8LJuXH4PTBR0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gIVW+MI2vCMOl1Pt+DuMVG16A2D0jtPxL9mX5GQYlhZLhMNJNlbbiOhm39dN+uGDLQ89oMJbrrdv94CpzKosvFHWFp5et0VnErKi7KCygYByD5aQrI2CoQ+RuahiRMxfnXlpFyyCMx1SJRHxiGL7RBYkD4DbN7T5GdSM+fFldI8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=OQr75EHy; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FOEO53PWfz8jVV9tqBTYQ+FUQRTS1bvm3k8jdLn41jA=; b=OQr75EHyHvbJCafMkmm/u1U9WI rSXH+ccZ23rmyziIKdQuyZHcIOIEAarZQfY3CZ+sW2Bs2bcKF0Jf5btQQux+Fe4wU5/ihvYNKUvZ2 3wC21wd5ZMtIyb6yDO1Tl3deOcGLOMsj8hZwpQs/rtG5GSki/I/GJWEMcPnvpzk7Pd9Hn1AE17tDo 1XfjuN4IMv3/ZassAySEFV9njPS2tsqul4pzMedj8i6IorgoDdqTU/Xkn4IRSsLLipvXMzJPny8Qo Ximm6jprNiDZNDAd7NUxwMxhCIEOH48MXeQ7ytjySnL5agTbNCVV893+/Iv1RpIHaTBlcUefT/SCp NU/gvkiA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1reavd-0000000HEuq-0Ow6; Mon, 26 Feb 2024 13:21:57 +0000 Date: Mon, 26 Feb 2024 13:21:56 +0000 From: Matthew Wilcox To: "Pankaj Raghav (Samsung)" 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: <20240226094936.2677493-13-kernel@pankajraghav.com> 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()? > + 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 >