Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp472567pxb; Mon, 16 Aug 2021 09:32:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrKsYkOAzksjofNEjzGu0WfQgIYCg7a3ssai9MutV3CCkWHBMlYuhz+8YqZKaVTk/r8yBp X-Received: by 2002:a17:906:140e:: with SMTP id p14mr17558829ejc.235.1629131562338; Mon, 16 Aug 2021 09:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629131562; cv=none; d=google.com; s=arc-20160816; b=pQocX7d9ZgeIaoZbEUzgh7AGWsG1PixfJ0b1xmyAVbbOH7HhnUkKWnjZ8N9OAfJNU9 ibq62tWDAYfCpMTuL0S5ZVnpBG2uSh/aAxv4+jBqltXqDZzl+TUAcNq6k9CRcAwgpCsp 2A1umERl14qSU2FxWI5ZWi7FLGAgRMU0c2GgRIYtOumBfx3Q51D/5klE8EE/QDCJZRPI qdu1AYqMUJAYDtDiP1J+FUNN9LCHZsFFOBz7BixMhQBD06IOzpXjgLSOO0+HeSAz790z k5Wl8eVo58ZhTPJu6vfxaI5ihx0Y2SQQSzmmHmyJ42jrQy37k9y13OTMfYhqmlXW6ZkV z33w== 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:dkim-signature; bh=AQHbWOZjETXK025PEaVBeSGWavPhhgLfSL/2rlGWJZQ=; b=GnQmZ3bp7j7UUOj9XBa4wCACeru6YzaCOMzowI7jbBkoD2AAE/HHEfB334riEx+2ra KuT3XSfSR5WP01zEWtiq+xBJCCfdwXjH34lZ+GEqsLvANZteDddFF0rUe8biI6R8rVWE 4NhnZLd7ssUKwr7d+g2/0Qhkr2RhFPkJK382IkFamYOLuMC1jQcNbZc3RaySbM0uXtjf 8tmqSX3corSXsyOJ6Jvh1uByfCcQaulcLTduykq9wtwDhC0G3yMQ5l0tS65WTHOXvo+Y EJ6BBsvqjbg29/guqRW/wqNZTxCM/2HVvwrAHSlETDL1N7zAsMacukNlM/8nG9vOMeWt 3r1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=BNmfU2s0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si11664485edv.125.2021.08.16.09.32.17; Mon, 16 Aug 2021 09:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=BNmfU2s0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230051AbhHPQa6 (ORCPT + 99 others); Mon, 16 Aug 2021 12:30:58 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:47138 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbhHPQa6 (ORCPT ); Mon, 16 Aug 2021 12:30:58 -0400 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 7D8683F36B; Mon, 16 Aug 2021 16:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1629131425; bh=AQHbWOZjETXK025PEaVBeSGWavPhhgLfSL/2rlGWJZQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=BNmfU2s066DTpWSnzFRf/WZtr8fq0A1Il8w8JslCFFNyv9DFwswWeKFK0kpgBWZTV +RLfiTr7zJOwBGpB189OzlLSdv7GMgOdcVHg6I9kUrmZcqlT+c7oWy0HYaqSFbTE6y SC1nQyVpCvUOHdjpiB5umYWAtq8d70tYxDlXEEJBl9Uvd2omykGsfAe4es0xd6AIsU GvJTwtdLKzSn0265zFYe2wMTYDhPeF7mE6DebVuGlA7Yo6+aHjBikR9fy805udHgL+ hHOP3Q/x89Q9OYOKQCmiwf2h1/nz1aeCF4ikugMNG9rp1FFbvAS2J4VFA5zyn1aEnD JKiX19FpJAQ8w== From: Colin King To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] fs/ntfs3: Fix integer overflow in multiplication Date: Mon, 16 Aug 2021 17:30:25 +0100 Message-Id: <20210816163025.81770-1-colin.king@canonical.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The multiplication of the u32 data_size with a int is being performed using 32 bit arithmetic however the results is being assigned to the variable nbits that is a size_t (64 bit) value. Fix a potential integer overflow by casting the u32 value to a size_t before the multiply to use a size_t sized bit multiply operation. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Colin Ian King --- fs/ntfs3/index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c index 6aa9540ece47..9386c551e208 100644 --- a/fs/ntfs3/index.c +++ b/fs/ntfs3/index.c @@ -2012,7 +2012,7 @@ static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni, unsigned long pos; const unsigned long *bm = resident_data(b); - nbits = le32_to_cpu(b->res.data_size) * 8; + nbits = (size_t)le32_to_cpu(b->res.data_size) * 8; if (bit >= nbits) return 0; -- 2.32.0