Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp736485ybc; Sat, 16 Nov 2019 07:49:02 -0800 (PST) X-Google-Smtp-Source: APXvYqx7OhTDcYxLAJIOyCcjC2GSH0fSmZMwvCPlytRq1FW4gfTaTrqwZWD8uwwDfq0qFwvCIfU1 X-Received: by 2002:a17:907:20f4:: with SMTP id rh20mr10364728ejb.82.1573919342484; Sat, 16 Nov 2019 07:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919342; cv=none; d=google.com; s=arc-20160816; b=1E1JjphhF09iuBSqcJX2UDz/BUP5e9Q9yX4ERBrZsC/eLKUec86V0H8sTpu8Yraq5+ ARwkQ0bJnxScDyJdzLRXNGutRcagoteB/q8WyV9n6pquUYGmh+h1vY/V4wZiu/eSLlgB nalzUltg9pdtvEozXiaduawF7LnVtXbjdNGUGmoqyH5C6OLu0A1l2DB9cxB3s2qVRxOP tth0trtH4GLZ/6wJfearfziefV4N1KLIYcKZRmbdMUyTQ+cZe/IWS1I8U2deiqkc92uN H/i1dyBg3RUs+1QRe0AaoT1c1NWJV2OHH1H3YwCdaezdUfaedHuj5CWernt9T4pnoaRf C1aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DGjHdPTIpEVdElyfCex3dlraXi0rGT2dVIZC6PS6D2Q=; b=EIXyVkus50SXhMbFVW4wBkahPPtgf91hBb1O/9cCEwBPmO/JY/gnW06ry1ZnNpANym a0ukV5VQQepnPWRAN5ce4XXxCbsKPsWf6l8yDjKxOmJAOGJejiQbtvLhQnCpoORunRrs TbxUtMq2zER9wUgm/seNpxUGo1uXZpWMckcZldkTUB0u1rvSQbkM4taxQZa9rTE9hlIm UNvARKWig7l1tsMFLUK2eOurQatXAKE1AuV1uZtiW65wU2puSFpdVRyi1gFjuWf8g1Uc nk3mREP4hRHKhyXM+5JoE/Ri7gVfPNO0ERA3BGl9Dx5g6R5+C4u/u0jQxserMuhv0tek LCwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Er3rUtXv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si8314198edp.357.2019.11.16.07.48.38; Sat, 16 Nov 2019 07:49:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Er3rUtXv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728627AbfKPPqN (ORCPT + 99 others); Sat, 16 Nov 2019 10:46:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:52232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727972AbfKPPqG (ORCPT ); Sat, 16 Nov 2019 10:46:06 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93A8020862; Sat, 16 Nov 2019 15:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919165; bh=O+KNYKwrYXlnpwO1GIlUFnzRl1BQrKkUD6M9YTg3B08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Er3rUtXv+Y1+XVmsvMFWTRe8OvQAb1eVO1C/ofNlm6zPc57NcnCahrIT2VnKjkW1t MpANyNsjwesOQFZBMNWrTFn0CnNJHtZjax7qrsFcWXaImyattNF/IND4OuDiCSNw3t yKG97VIioXgxWN2nVz970L3JbLmRh3kYIi3s6o/s= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michael Kelley , Thomas Gleixner , KY Srinivasan , Sasha Levin Subject: [PATCH AUTOSEL 4.19 174/237] irq/matrix: Fix memory overallocation Date: Sat, 16 Nov 2019 10:40:09 -0500 Message-Id: <20191116154113.7417-174-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Kelley [ Upstream commit 57f01796f14fecf00d330fe39c8d2477ced9cd79 ] IRQ_MATRIX_SIZE is the number of longs needed for a bitmap, multiplied by the size of a long, yielding a byte count. But it is used to size an array of longs, which is way more memory than is needed. Change IRQ_MATRIX_SIZE so it is just the number of longs needed and the arrays come out the correct size. Fixes: 2f75d9e1c905 ("genirq: Implement bitmap matrix allocator") Signed-off-by: Michael Kelley Signed-off-by: Thomas Gleixner Cc: KY Srinivasan Link: https://lkml.kernel.org/r/1541032428-10392-1-git-send-email-mikelley@microsoft.com Signed-off-by: Sasha Levin --- kernel/irq/matrix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c index 92337703ca9fd..30cc217b86318 100644 --- a/kernel/irq/matrix.c +++ b/kernel/irq/matrix.c @@ -8,7 +8,7 @@ #include #include -#define IRQ_MATRIX_SIZE (BITS_TO_LONGS(IRQ_MATRIX_BITS) * sizeof(unsigned long)) +#define IRQ_MATRIX_SIZE (BITS_TO_LONGS(IRQ_MATRIX_BITS)) struct cpumap { unsigned int available; -- 2.20.1