Message ID | 20231123100627.20739-1-abelova@astralinux.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp338379vqx; Thu, 23 Nov 2023 02:08:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRqrCaaKn+/sxtIRQeTZmK9C6W+qEdz6FVwSXO91ph0xrKeNgnBiYRfl7OCk+waVBB0tg+ X-Received: by 2002:a17:902:e88e:b0:1c7:495c:87e0 with SMTP id w14-20020a170902e88e00b001c7495c87e0mr6138913plg.37.1700734104685; Thu, 23 Nov 2023 02:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700734104; cv=none; d=google.com; s=arc-20160816; b=hIl0ScKHmE/I8MUCPDR1a+knDwgNEKFIplxOdR6u3nFw2XaRWUp8jEawFzXys40caj Bd/X/zr7Hfd1fhZM+qNZaSO3b+/k1q49jhtBiTipBZ6fDapAqV6EXI3fArz0b/HjeUfR 9AQHEZtat4JflZoZnfEcmIcrJu4DBbCk1GEr8tJ2ikgJ9LgzSSXJPM/cCbMvFuNOqE/g osoUOGaMesNHmCRJ45TJqkU57p9vm0XJp3FZMlMPHOhJfI8RoACHKORh+/L07peU5Fs0 IPd+xl0D5qfsKniQjj5vg/ouZf6yEzZr7kS/SRXdwp9RsLjVPLNW4cP0WPcgsRVt1ksf ZhYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=25boUT2RXe7cng5b71O1Yl2ReQmgts6NU1nSjQCfzjw=; fh=UcRm+ezdnYx/I3LURioxPIqYpNvdqaRAHiZtDdDCYyM=; b=b24SHmVPZNC6ZEa+P2wesjQVYTulo+QeyKC0wYiMOsRuWUUNpWxetWoL2x36w2a+Qo ilDnyTq1ljIsKPZY2V07uktXDt+Htob+uARdEbQDVMfB7O/FQ4pO2lsiyh9olyzXNlhO r4OzsQJS5uFXNPkDSljlVlPzEmG89Z/uauSOG7tyVPPXnx1pPE+KKaMEeVe/0maaw7DI SwHl2D4j3AS615Ah0GqLtULWx6+1dpnOjVV9Cww8hIbgXoQRaKaLSC0zyS9sq4eqcSNx TpSBaDM/52cqrdYQQ127ErHYXuLiIq3yNcLKsFTyEXwNZPN/d5LhMLVz8sMzZjwuAHbJ NfDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id n10-20020a1709026a8a00b001c746bca05dsi798529plk.69.2023.11.23.02.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 02:08:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C8FA68321297; Thu, 23 Nov 2023 02:08:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344352AbjKWKHi (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 05:07:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235330AbjKWKHR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 05:07:17 -0500 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130AA1A4 for <linux-kernel@vger.kernel.org>; Thu, 23 Nov 2023 02:07:19 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 57D921869539; Thu, 23 Nov 2023 13:07:15 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RbGep-jMkJqD; Thu, 23 Nov 2023 13:07:15 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 0F1A71869262; Thu, 23 Nov 2023 13:07:15 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id d6HvdqWtd_uB; Thu, 23 Nov 2023 13:07:14 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.12.19]) by mail.astralinux.ru (Postfix) with ESMTPSA id 6D1E91869539; Thu, 23 Nov 2023 13:07:14 +0300 (MSK) From: Anastasia Belova <abelova@astralinux.ru> To: Anders Larsen <al@alarsen.net> Cc: Anastasia Belova <abelova@astralinux.ru>, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] qnx4: add upcasting to avoid overflow Date: Thu, 23 Nov 2023 13:06:27 +0300 Message-Id: <20231123100627.20739-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 23 Nov 2023 02:08:19 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783348964453019083 X-GMAIL-MSGID: 1783348964453019083 |
Series |
qnx4: add upcasting to avoid overflow
|
|
Commit Message
Anastasia Belova
Nov. 23, 2023, 10:06 a.m. UTC
To avoid possible integer overflow in qnx4_statfs
cast literal to unsigned long. Otherwise multiplication
of two u32 may give a value that is outside of the range.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
---
fs/qnx4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Just a friendly reminder. 23/11/23 13:06, Anastasia Belova пишет: > To avoid possible integer overflow in qnx4_statfs > cast literal to unsigned long. Otherwise multiplication > of two u32 may give a value that is outside of the range. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> > --- > fs/qnx4/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c > index 6eb9bb369b57..4be8dba60567 100644 > --- a/fs/qnx4/inode.c > +++ b/fs/qnx4/inode.c > @@ -133,7 +133,7 @@ static int qnx4_statfs(struct dentry *dentry, struct kstatfs *buf) > > buf->f_type = sb->s_magic; > buf->f_bsize = sb->s_blocksize; > - buf->f_blocks = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size) * 8; > + buf->f_blocks = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size) * 8ul; > buf->f_bfree = qnx4_count_free_blocks(sb); > buf->f_bavail = buf->f_bfree; > buf->f_namelen = QNX4_NAME_MAX;
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 6eb9bb369b57..4be8dba60567 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -133,7 +133,7 @@ static int qnx4_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_type = sb->s_magic; buf->f_bsize = sb->s_blocksize; - buf->f_blocks = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size) * 8; + buf->f_blocks = le32_to_cpu(qnx4_sb(sb)->BitMap->di_size) * 8ul; buf->f_bfree = qnx4_count_free_blocks(sb); buf->f_bavail = buf->f_bfree; buf->f_namelen = QNX4_NAME_MAX;