From patchwork Wed Apr 11 07:33:06 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: 10334969 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 888466053B for ; Wed, 11 Apr 2018 07:33:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74D072874B for ; Wed, 11 Apr 2018 07:33:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 699B12874E; Wed, 11 Apr 2018 07:33:22 +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 0F5C82874B for ; Wed, 11 Apr 2018 07:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbeDKHdU (ORCPT ); Wed, 11 Apr 2018 03:33:20 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:52440 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491AbeDKHdT (ORCPT ); Wed, 11 Apr 2018 03:33:19 -0400 Received: by mail-it0-f67.google.com with SMTP id f6-v6so1533902ita.2; Wed, 11 Apr 2018 00:33:19 -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=FaWaxqxDCT5C5qUL/EALbsHLwu1qbNAhXWmzIpPgUy8=; b=YBrGhBK8bhM6HUwuwOGLVN5PCazB1/vvaEAZ/d26nMguvy2Oo+4zvwR3NNNNlAIJyQ ARbO9LiEOKyK8h4nOL7PeltQB67Wpvs37Vin2nv8KZ0uR1CijZXE1vz2oA18vcBMC/m7 fsgy1F1j8AFuUK+ug55uoz1yyBPGKLxvNjrzWlzhVPp1v/RbIs04N4l6AMnoF88n7HaE dqN2PMhJUdhFQ/BCMIq2vTSRGFZYLQ0B4gU768cBHj++Nn+hDRf+yiloqSktA/eo75ep DykbYme6orFJ8vrAnejiWEqajKAGI4bTHVUbIogsTU707MIgyLaf5JPIhW71VsTYxRiM HmCg== 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=FaWaxqxDCT5C5qUL/EALbsHLwu1qbNAhXWmzIpPgUy8=; b=X2LGUOvhvXMyt0BcT5MeoLGFYBGu6s0KyJ0Ge5Z+TN+JA3jIp96XHz1toviLfF8pvv 9z/qPX+vRE9zQuPhpYo+WQL0ugOjsriNjGG8HQR3jz1c++3JqUZdC7PLQj0cGqC79Ah0 SjuW0kAWMSKTLeC6zognHFuum/oI7msVX5HIOhCqM2mWPc1qpHXQv72W18NKKoRc4AP8 udSJ0fzzLC6WhraBMVUMbrUAaA6BuV3wfv/3dIiYdGnZ50lad/6kA6u3BqIbXwPsQLPA xpxD6BQ+VWkg1vrsLDHJDKnBD9GRZWMVJ0lJ9jRadaV0YTj6FG8jh6W85lwlWDYBV++1 b43A== X-Gm-Message-State: ALQs6tC5ZSKnkCt86sV5vb4EaUMtZnYXz3KFylDCFHjtJPdZ1imVS7tl oXG0QallvHYG/Jlrq25vyPE= X-Google-Smtp-Source: AIpwx49jbo6DCsoRlplIg1whekf6P4s1JCsqwkTbXsCRyg0Kby1XnQgpoTw7s2dbunXAfx2Ncq78Hg== X-Received: by 2002:a24:f405:: with SMTP id d5-v6mr2801910iti.32.1523431998846; Wed, 11 Apr 2018 00:33:18 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id d27sm253014ioj.48.2018.04.11.00.33.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 00:33:18 -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 3/3] infiniband: i40iw: Replace GFP_ATOMIC with GFP_KERNEL in i40iw_l2param_change Date: Wed, 11 Apr 2018 15:33:06 +0800 Message-Id: <1523431986-3596-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_l2param_change() is never called in atomic context. i40iw_make_listen_node() is only set as ".l2_param_change" in struct i40e_client_ops, and this function pointer is not called in atomic context. Despite never getting called from atomic context, i40iw_l2param_change() 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_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index 27590ae..b86bda8 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c @@ -1737,7 +1737,7 @@ static void i40iw_l2param_change(struct i40e_info *ldev, struct i40e_client *cli return; - work = kzalloc(sizeof(*work), GFP_ATOMIC); + work = kzalloc(sizeof(*work), GFP_KERNEL); if (!work) return;