Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5425074rwl; Mon, 3 Apr 2023 20:49:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Yk4rKMdiNa7yDh5DQJUVacFhn0mpIZQ0SsN4dZBy9DLaRh9dmUR7d2qMdOyNo3czdfCzDV X-Received: by 2002:a05:6402:609:b0:502:251b:3a4c with SMTP id n9-20020a056402060900b00502251b3a4cmr1165135edv.20.1680580175575; Mon, 03 Apr 2023 20:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680580175; cv=none; d=google.com; s=arc-20160816; b=Wtrw6XaQ8xGHVuSrzVxuVEkyLfzz7dqTLdokkY0QXe8Dk3vPQ6tX6TcWU+TynPUYDY ymz/3EFKZp5YZhFtcjlETzAkMyg5kTA04h8gk/aKkfQ6mV4cHGMInZ8oHn3kmdhBQBa6 udRYiRvRpXvGOAU6+VXdOzRU86F4ltDfj0/MlhTHyo82NsPARG90kAojIROerqpxIumZ 3S4jd8XCBDcEunUbjcRczDegtOaJ0Jsz/lrG3mmO4OLCN3/eq7qFHLOJ64svWtUvDmzq G68xn6otZ4PwLL9femfgNDz/WfFNIwLTY8vrb6ps5dWNmRHaYNCjEBHQREGehW/vqGMM xIJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=k1rQvXrNNJdd31+9AY3b02aZnuxnFQyMxmz0+mFMwKE=; b=HqaX90GYtAjVlLz8LUsd23CZIVTEHw7r4/cl8wzDTnPwJKWSFO9Q/gBcDS9TZIwWqZ /jv7xZ0qFbeLHRvzcHM5Emp4aAzbgBwv0EDOV+1lf8sNnYaHhk4HSWWGNSXFzT4GymY4 QSks6IQ4yjKFFRkdjcKJRMWBybreK8IrtXBu/6RPS0JxTxb/vnwxpQliYl7ugtpb9AYv scVD6RN1Lhl5YbLC6DPehaoFJXd3tAtmInJh6MNJC2o9PMzE91nJqSz6w82Qu66f4G29 e5oP/wl8DwlMyLAX5NO4Q6PgBATpxvB+QXjYXTts9+SnKLZrrw3JAAFHjuRGKEcSMisa Vseg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=e8OIhkaG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e24-20020a056402089800b00501d531e504si9776460edy.323.2023.04.03.20.49.07; Mon, 03 Apr 2023 20:49:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=e8OIhkaG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232473AbjDDDhN (ORCPT + 99 others); Mon, 3 Apr 2023 23:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjDDDhM (ORCPT ); Mon, 3 Apr 2023 23:37:12 -0400 Received: from m126.mail.126.com (m126.mail.126.com [220.181.12.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66EECE47; Mon, 3 Apr 2023 20:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=k1rQvXrNNJdd31+9AY 3b02aZnuxnFQyMxmz0+mFMwKE=; b=e8OIhkaG1Qphn6JcA+hIYz3Ctf+ha+rJhN BbCKFUBRrUIvyA8fJ69QYc8E2IrTpTtCZHHFxd7hPuxQAupAkLIpn5gn+If6px7K XROLYLQacJnIGVvzTeVc/VuZjNEET9WrkgVHKzgWN6XebQzx+4PUrIZxmyOwySeW 1/5Zf6jZM= Received: from localhost.localdomain (unknown [116.128.244.169]) by zwqz-smtp-mta-g5-1 (Coremail) with SMTP id _____wC3p0_2kytkxp+dAw--.17217S2; Tue, 04 Apr 2023 11:05:27 +0800 (CST) From: xiaolinkui To: dennis.dalessandro@cornelisnetworks.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Linkui Xiao Subject: [PATCH] RDMA/hfi: add a judgment on the availability of cpumask Date: Tue, 4 Apr 2023 11:05:25 +0800 Message-Id: <20230404030525.24020-1-xiaolinkui@126.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wC3p0_2kytkxp+dAw--.17217S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZF47trWUWw4kZF47WrWUtwb_yoW8JFW8pF 45ZFWjgFW8Xa10ga1kAa17ArW5tas7JayvyF9Fqw1Sv345Xan0qrZ8K3W5ZryIkFykGr1a qrsavr1Y9r17WFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07Uh18PUUUUU= X-Originating-IP: [116.128.244.169] X-CM-SenderInfo: p0ld0z5lqn3xa6rslhhfrp/1tbiHBxH1lpEJlhTQwAAsh X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linkui Xiao When CONFIG_CPUMASK_OFFSTACK is n, cpumask may fail to allocate, cpumask may be NULL, and performing a bitmap operation on cpumask may cause problems at this time. Of course, this is a unlikely event. Signed-off-by: Linkui Xiao --- drivers/infiniband/hw/hfi1/affinity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c index 77ee77d4000f..3caa861f4d1d 100644 --- a/drivers/infiniband/hw/hfi1/affinity.c +++ b/drivers/infiniband/hw/hfi1/affinity.c @@ -1047,16 +1047,16 @@ int hfi1_get_proc_affinity(int node) */ ret = zalloc_cpumask_var(&diff, GFP_KERNEL); - if (!ret) + if (!ret || unlikely(!diff)) goto done; ret = zalloc_cpumask_var(&hw_thread_mask, GFP_KERNEL); - if (!ret) + if (!ret || unlikely(!hw_thread_mask)) goto free_diff; ret = zalloc_cpumask_var(&available_mask, GFP_KERNEL); - if (!ret) + if (!ret || unlikely(!available_mask)) goto free_hw_thread_mask; ret = zalloc_cpumask_var(&intrs_mask, GFP_KERNEL); - if (!ret) + if (!ret || unlikely(!intrs_mask)) goto free_available_mask; mutex_lock(&affinity->lock); -- 2.17.1