From patchwork Wed Apr 11 07:32:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10334965 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C92360134 for ; Wed, 11 Apr 2018 07:33:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 793FE28747 for ; Wed, 11 Apr 2018 07:33:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DB4C2874A; Wed, 11 Apr 2018 07:33:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1548328747 for ; Wed, 11 Apr 2018 07:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751553AbeDKHdB (ORCPT ); Wed, 11 Apr 2018 03:33:01 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:44968 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750837AbeDKHdA (ORCPT ); Wed, 11 Apr 2018 03:33:00 -0400 Received: by mail-pf0-f194.google.com with SMTP id p15so514513pff.11; Wed, 11 Apr 2018 00:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=43jVko6O1wQPPZNz8zlMl6PipFYzzhP41VkuCbzlpv8=; b=YACxBkzB/aHqqokTi+vUYAcZP9txQT6+tpyHY0AbR4OjwFVOtBwSAu+xSPp13wmHCC PDcWm18ClBBksU5Zk0NVpwfFQGiW8IkB0KyoZzFTyN3Xx0Af0zfOH7HQDiVJE76hYbN0 KrVsK7FMBdiYwBm5oPc22ajPDl9FtVKrfeq0JzKHo03tPBC65dW4jz6VqdlhXdidbcZ9 bnGkUChi5iU/SltmBmckCDinCTIid7JZOJ/kq8fxoeJXLpTht5IpQ/FmVUv+Hn43GeZj bpSk8DzrRVOy2T7z/hE25SABluwm4y/904EYKl+VJRL1lJ0vPj6CydqOKAdMVD4UlD4b wYMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=43jVko6O1wQPPZNz8zlMl6PipFYzzhP41VkuCbzlpv8=; b=L1pf0JQiEpakbYnmhrMkcnEEBQ+nHIDdYFB+ElfwdSSTMELskpSxe9nTq0Ar2E3bKG 2csn+EAw4yYsnvK6EozFybihscdW9ZFujEmJEC18xHzYicYuEtVVhemhLDk3qC5OezA0 otG59L4o2/eEu8Rff53vYd21JrwwfDXIXJCEurNixY+E7asnmz4U8taoMBsceVJ3Ui+F t0oy/KeIql/rUo4Zzzm2RtJ7xhHu9DsB2T7P9hzOKqF2JkDRNrmexgrqMWWdkAjDNHII dD43/JfkB43Ir+ivumdjKAtrzO3lSspWRVLue1OklkIJMl+Xf7vekQXZSDpr3jhOyyTc pfBA== X-Gm-Message-State: ALQs6tDSsUh6aKoVndtA1CM10UeRnlhEDZLbFqYTkMrGQafrmCKpVnRD hEcGxTUVx+zbMU1hsG92Abo= X-Google-Smtp-Source: AIpwx4/kIftf+zIW1WZq7hHD9TBSfmyKKgHIm3b3YWmyYt58ee2lE2U80rgZQ0kHhrA1G++vS3JUgw== X-Received: by 10.99.121.136 with SMTP id u130mr2616134pgc.414.1523431980261; Wed, 11 Apr 2018 00:33:00 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id 204sm1225397pgb.67.2018.04.11.00.32.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 00:32:59 -0700 (PDT) From: Jia-Ju Bai To: faisal.latif@intel.com, shiraz.saleem@intel.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/3] infiniband: i40iw: Replace GFP_ATOMIC with GFP_KERNEL in i40iw_make_listen_node Date: Wed, 11 Apr 2018 15:32:48 +0800 Message-Id: <1523431968-3552-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP i40iw_make_listen_node() is never called in atomic context. i40iw_make_listen_node() is only called by i40iw_create_listen, which is set as ".create_listen" in struct iw_cm_verbs. Despite never getting called from atomic context, i40iw_make_listen_node() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai Acked-by: Shiraz Saleem --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 5230dd3..d021399 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -2834,7 +2834,7 @@ static struct i40iw_cm_listener *i40iw_make_listen_node( if (!listener) { /* create a CM listen node (1/2 node to compare incoming traffic to) */ - listener = kzalloc(sizeof(*listener), GFP_ATOMIC); + listener = kzalloc(sizeof(*listener), GFP_KERNEL); if (!listener) return NULL; cm_core->stats_listen_nodes_created++;