From nobody Thu Oct 27 03:20:32 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MyWCN2728z4fvy5; Thu, 27 Oct 2022 03:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MyWCN1f2Bz3RgS; Thu, 27 Oct 2022 03:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666840832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z0M1Im5IE0sfJ40Fs2eI5zZB+D24t3JsGuA8A5ywj88=; b=GEDCCigMQJdUPeTmg9tsWkW6kJbWuoBJ3rJHJmvzrgpST4Mgk0pLPjNvHaLOz2BMlGlC2o 7cfiXNwarsT2fYK3O/eQIpbEhOpYi+eaxm8CDBkIDJ9/oZw4l+NHXipv88Vg3meBDDCJ9j hEFJoP21p/LRIkvWBid8RVj4730FVqND0dQfHS+etNELNWqVyhtx7pknw10efVkfk91z6x u/sMrOTfeV0HGWlwcI6KwonDIilkImpLUblcl+H6coFyoZUFo2Vdz2yqYIiV76pwhuDQIo 529diUHA+d0L0wPhIFoYJ3ZScLy/cqz51/CqcUHl887ADibfWnbCPE286cfRfw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MyWCN0kVXzj3s; Thu, 27 Oct 2022 03:20:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29R3KWjA083664; Thu, 27 Oct 2022 03:20:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29R3KWLC083663; Thu, 27 Oct 2022 03:20:32 GMT (envelope-from git) Date: Thu, 27 Oct 2022 03:20:32 GMT Message-Id: <202210270320.29R3KWLC083663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 017367c1146a - main - ffs validate_sblock(): avoid 32bit mul overflow List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 017367c1146a69baca6a1a0bea10b0cb02c72d85 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666840832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Z0M1Im5IE0sfJ40Fs2eI5zZB+D24t3JsGuA8A5ywj88=; b=sp2Bmal5nyPAQIergnBXHSMvMwHXYHYy5a2KQPcUnp6X+TrVyy0ikCcAcnDvLfPLhF7ej5 hsQO0b44rhOvuD7h3lMV59/OatHdVxuu+wWXzpwGWMobXRI7SD1NxDUj9wMmyHH2FucXcs 0BzzXUxShgOQ5ti2aBq/KplohWc1jJsyFgPvnSHnVAJIdcWDKb5NvSJgxfWvoM8esgxAYK KsKQ2pPSS8xuUAB8rS3tyXxvLm3uKQH9Z7KMuj+l1g1KoVt3aMNrur5ptEiqwNRMq/Zgdy nBda/11PvEUb/7HraAVJrsvxfX4iDHH/lotWqjgoOmUGPHIYbyGJs9BIvoyoFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666840832; a=rsa-sha256; cv=none; b=gTh+Ke65wgRe9Lg+tlrE4xlVA6IxGp+RUuTNzB0jrIBxkwctPfNhUcz5x4K2A7xviQ00p1 5kmtI4Vz/FYHrz3zjKgg2dh9MqqnsW4u66VY3fg5SJkQrR7ac8iahqDRUA3rrp5xG78hrI yMSm31bI4h8EEvB/AjYhfz8Gzp/LAqwP8nJ9o1fsEqwXepfBV0NnWMTvGWMw9DdAjdzqdm J6HTdfkgrrH1uUBBRtl6uS5y0Spu4UIz7eFjTOv9zMQ47UnZ1Ba4TKf50Co56HPtFP/OFA QRuyCDoHsI8Ya1gUoxBQGDgtVsn4vXiaYinuq9BsA+DYzyZ0sX2lC6/ZFQdxdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=017367c1146a69baca6a1a0bea10b0cb02c72d85 commit 017367c1146a69baca6a1a0bea10b0cb02c72d85 Author: Konstantin Belousov AuthorDate: 2022-10-24 21:34:15 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-27 03:17:38 +0000 ffs validate_sblock(): avoid 32bit mul overflow Reported by: soralx@cydem.org Tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/ufs/ffs/ffs_subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index e804dfa3d330..b6b0be56fc73 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -546,8 +546,8 @@ validate_sblock(struct fs *fs, int flags) * and ends in the data area of the same cylinder group. */ FCHK(fs->fs_size, <, 8 * fs->fs_frag, %jd); - FCHK(fs->fs_size, <=, (fs->fs_ncg - 1) * fs->fs_fpg, %jd); - FCHK(fs->fs_size, >, fs->fs_ncg * fs->fs_fpg, %jd); + FCHK(fs->fs_size, <=, ((int64_t)fs->fs_ncg - 1) * fs->fs_fpg, %jd); + FCHK(fs->fs_size, >, (int64_t)fs->fs_ncg * fs->fs_fpg, %jd); /* * If we are not requested to read in the csum data stop here * as the correctness of the remaining values is only important