Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp552362lqi; Thu, 7 Mar 2024 05:24:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkNREFimoPXf0Gatr8eKiYFzhi3mjS5W2n79fWFItwQy9SeDF/tjLJbEzuXisBw3Dz296KmfsbCCJh2uJK3/xd1gU3FhA7UeDsefYzkQ== X-Google-Smtp-Source: AGHT+IE/Zot8Jf9N1OZNSDgNL3BBVN0O7le9CODlWsWuod93gbWq1t3aeWUrMfGn0etUShTC1C6A X-Received: by 2002:a37:c242:0:b0:787:bb6b:f024 with SMTP id j2-20020a37c242000000b00787bb6bf024mr8839794qkm.60.1709817861902; Thu, 07 Mar 2024 05:24:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709817861; cv=pass; d=google.com; s=arc-20160816; b=DmN6Q+cgdo67ueo+YqauZMxhPKw2igFLB0TMyB8qpExGHrgJ2XMAmEyFVFff6op3HY 93LM095VVXsrgn11IxI+qhR92vEwvMbt/EHFmnGaNtoRnBwMm9Iwx8WtAfWdsT1qR2qt nnjRoOvPGW//9zrQSpK1V/cgs/AW4sECy6cr2baZ6IAnmw/cNPnlRKnbNXax1vNg18sY FiTViFqkdT3o8e7qALIAO6GGkSZ+4PgoKzrnkGBO22kEHV2bbfCih1iUKkM3il+dCiQ4 lFeW57ELBnnM/R2XvAU6BeSNbyQv21JqOYoZNo6UaHbfJm7tFV7plUx2/bZ5rQQKBJY7 lWAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=xhISMZWXa8iwJrQyJDyimfz8M1Ynf4psobBl24l68yI=; fh=X8EyFtxdYAtwI1ujYoOeqTW2dEYo2k8RGyAVWd+3KKg=; b=Nx+zbhyykmZZ68Vh5AWFpWAHG4V/nhf1uLPnwGtpfFwfqyhno/bSLLRpRqAwiFifwH 8tZXTeOHukfRZiTtHy1iVyMp1pBnEyDNaeT1Sbx7pTbfJ2No2YRN5tLoPqJ8j3wVIutP HHqEFYRzBaJWUcxIlr0DpeqIhCWfKHYUWQ99Cb0hDGn9nMkRZ/szKVLsvFpEaHerUsQw afQIBuQ23z8CtE19LJlQPLKkDpaqVuJK3A7ORJig+coXJXLV22gC4ZoDHlpy/Udf0Fna u5V3CRC6MexnqoSsuLtDNa+t8UJiNIViCz8n0nH4AtZCcisxhzlyMsXNEfsx1H3HWmJS bGhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-95591-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95591-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x3-20020a05620a448300b007884d02c2f6si159949qkp.367.2024.03.07.05.24.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 05:24:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95591-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-95591-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95591-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8D55B1C22A50 for ; Thu, 7 Mar 2024 13:24:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B48812C553; Thu, 7 Mar 2024 13:24:16 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4A9212BE84 for ; Thu, 7 Mar 2024 13:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709817855; cv=none; b=UlYJUm5zrVm1Ycq2zRrKBhuiJd43iQnRS/UvpRjumkFZMJhjMUOu+754+sJpwl8x7oq3yo91bXIlwDwO98sa53i6ZEI3lxn4tT9ZhBhDxx/lrTpzqEpPCeaR3Wp/xbFHMAVxrY/+Golfji7KF1NtgqBTMjGkGx82O5PGv4kx7u8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709817855; c=relaxed/simple; bh=FWwSJ5IJGCnInO6ndAopN+p5PC7Rv8Ze9UwyQh7OHdQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=At36mOjGfnGETIYTOto0g5FpFg0TxRetBhQpsAwr8dG4wxN9gYZKqf7WheGKXLrhowvXXUPUprIX1nokdKHewi2g2Gmm88yMS2qWn7BzbPN7vDM5ltVGEMbaB0rrFgMy9UqpboYFeePe6IvoOhOb6xk8ql3wJa8ZaD869uWT1f8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Ingo Molnar CC: Daniil Dulov , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , , Subject: [PATCH] sched/topology: Check return value of zalloc_cpumask_var() Date: Thu, 7 Mar 2024 16:23:40 +0300 Message-ID: <20240307132340.13192-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-04.aladdin.ru (192.168.1.104) To EXCH-2016-01.aladdin.ru (192.168.1.101) zalloc_cpumask_var() returns false if mask was not allocated. So, let's check if cpu masks are allocated successfully. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 8d5dc5126bb2 ("sched/topology: Small cleanup") Signed-off-by: Daniil Dulov --- kernel/sched/topology.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 10d1391e7416..2df98ffdfe16 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2600,9 +2600,10 @@ int __init sched_init_domains(const struct cpumask *cpu_map) { int err; - zalloc_cpumask_var(&sched_domains_tmpmask, GFP_KERNEL); - zalloc_cpumask_var(&sched_domains_tmpmask2, GFP_KERNEL); - zalloc_cpumask_var(&fallback_doms, GFP_KERNEL); + if (!zalloc_cpumask_var(&sched_domains_tmpmask, GFP_KERNEL) || + !zalloc_cpumask_var(&sched_domains_tmpmask2, GFP_KERNEL) || + !zalloc_cpumask_var(&fallback_doms, GFP_KERNEL)) + return -ENOMEM; arch_update_cpu_topology(); asym_cpu_capacity_scan(); -- 2.25.1