Message ID | 20240629233028.275424-2-thorsten.blum@toblux.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9918AC27C4F for <linux-arm-kernel@archiver.kernel.org>; Sat, 29 Jun 2024 23:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=kzngZ4dBsZTw3mzD7TJaRH343afEjYAiOI6vhb3xMXs=; b=RCLbDLEdesRadfdCdfx/W74VIQ oFSHVyFQYA26GXXQXilMiYa+/J5vE51uUfEa0fhAqm4N8c/Nce2Sg82SdfWxrLcQPMQRo8YaRRMAn Nozi5YE8UWq9BkERjAw2G8Sd2mh6dx9w0+XHdMuaj+6Rc+GYS3xJGWT77MfjRcEeic05drcDfQL3d O8cWPOR0j4FKtdjA2saVSNcovWldYZ9I/PYw7vg61E4o1htehwTj0kElYHYTtgTK1iPfatfe6BKbU KgM3cKN3Fsa14KVkgJHtEy0ms9GQ7gfydhSRdWRSXylyGmbKGUfkQRyaYG25dLBQtq2EYeWnmgWZP Jz2afKKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNhWy-0000000H6ex-3Lwz; Sat, 29 Jun 2024 23:30:56 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNhWn-0000000H6ca-3npB for linux-arm-kernel@lists.infradead.org; Sat, 29 Jun 2024 23:30:47 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-6b51ae173ceso9177146d6.3 for <linux-arm-kernel@lists.infradead.org>; Sat, 29 Jun 2024 16:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toblux-com.20230601.gappssmtp.com; s=20230601; t=1719703844; x=1720308644; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kzngZ4dBsZTw3mzD7TJaRH343afEjYAiOI6vhb3xMXs=; b=tf8+yJYaB8xUwHU2MLXbOEVbvMLhuUB35YtGfpk53ZfLjePe0W50FwoMwKhd/2bEFj 4FF5VqSFC5nGYydmR/fShm+UI4n2zLy7r+ixdqgNPm8kF4JdxoikIHBba/VeM1NZB9Ne 456jfiq0qdSMapgfykuiNYZ0CtEvbikNSUt2iduKBzUU+G9ZArDv/Noj0aY4lcfCMwVj L2qGeIZDoMRXg38SPB1Hq8aXPqpp1vm/2dO73ptmfosVNwfomqTM/zl+q35Fz5VWaL7D +PwC+CCMXoGEbK51eOcYwYrjU+w7FWXwuXgR3d5Ym2bIfwhS9os5o0+E4fJVqzrKkE7P pY9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719703844; x=1720308644; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kzngZ4dBsZTw3mzD7TJaRH343afEjYAiOI6vhb3xMXs=; b=N4Qt/QVSqTPX8sIf51T4wXcK19eVZUlK7Hp4YC5b71fwx2+Pqowv2GXsEXL+dETDq1 Yr+eq8VzDcUr9WiBDi0zTp9yjLpPvu7cplR+WJL82ZotvN+qLMVFDPqCiXFJ3/a2+qYP 9wP6hsBmLosnT4Nzod0Xy1/liO4Guo+qZVUXar5wLGWAX9GWvewKEBCOuUmxHbMfwyUF kAByXhgLOxpRnbDqwoRs5k6A6/7PISV3bG/9j3uxAZHztNYE66R/CfbuWcaHV7TAjZ1+ pZNw80gIUs6kcZLFYqxFqJUw4k0ZlXXKchvPgUneH4DreP1aDSRXegYaZJQN7MPEst7N HdGA== X-Forwarded-Encrypted: i=1; AJvYcCUBdZFEV41wVew6/JCXZrcARVTvFCdm6iO8ri6uSzM0kWSzt+fXfiuiPPQq58A+rXy1yAlhHvopnvjaXs8TupetVOIhTMLYHu1j26O/PkSKQ8rtszE= X-Gm-Message-State: AOJu0YyrQQsM6KbozCUz1XVqftDbjvfHGDV6wq5poMpqVBGeCARfpdfc SPOgdyoSuU2oZhGQgaReZ49jE2H8ovZyJIzE4ky4bpMpn5nTXgFEMsWOuPeKfZY= X-Google-Smtp-Source: AGHT+IHMoATyt6j5Mm2oZ60wF78Ol80+nzN8Vjq1tYadVGAVyarOr8GCKkzWv8xp4vKA1CkWio12pg== X-Received: by 2002:ad4:5e8e:0:b0:6b5:8de5:d0b7 with SMTP id 6a1803df08f44-6b5b71a5d60mr27016206d6.44.1719703843928; Sat, 29 Jun 2024 16:30:43 -0700 (PDT) Received: from fedora.vc.shawcable.net (S0106c09435b54ab9.vc.shawcable.net. [24.85.107.15]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fad31d5d57sm26608945ad.160.2024.06.29.16.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jun 2024 16:30:43 -0700 (PDT) From: Thorsten Blum <thorsten.blum@toblux.com> To: linux@armlinux.org.uk Cc: mingo@kernel.org, sshegde@linux.ibm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Thorsten Blum <thorsten.blum@toblux.com> Subject: [PATCH v2] ARM, sched/topology: Check return value of kcalloc() Date: Sun, 30 Jun 2024 01:30:29 +0200 Message-ID: <20240629233028.275424-2-thorsten.blum@toblux.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240629_163046_276867_C3F4E640 X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[v2] ARM, sched/topology: Check return value of kcalloc()
|
expand
|
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 2336ee2aa44a..27d6527f5fb6 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -93,6 +93,8 @@ static void __init parse_dt_topology(void) __cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity), GFP_NOWAIT); + if (unlikely(!__cpu_capacity)) + panic("Failed to allocate memory for __cpu_capacity\n"); for_each_possible_cpu(cpu) { const __be32 *rate;
Check the return value of kcalloc() and panic() if memory allocation fails. Compile-tested only. Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> --- Changes in v2: - Panic instead of failing gracefully by returning early after feedback from Russell King - Link to v1: https://lore.kernel.org/linux-kernel/20240628194350.542376-2-thorsten.blum@toblux.com/ --- arch/arm/kernel/topology.c | 2 ++ 1 file changed, 2 insertions(+)