Received: by 10.192.165.156 with SMTP id m28csp176144imm; Tue, 10 Apr 2018 19:12:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/lnf47EBYG67e64O+ZLwCCCeEjB7g4b82JGVB73MKa5fdhFBliB8TOhNKfjd8mJvZ/f4W1 X-Received: by 2002:a17:902:7d10:: with SMTP id z16-v6mr594534pll.79.1523412721584; Tue, 10 Apr 2018 19:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523412721; cv=none; d=google.com; s=arc-20160816; b=zkj+1byXBfadVv2NSo6HRvowiK3xd4RkCgQ1b1u+rVHWq7Qi9FVxdAV1LPPLQ/mBbw LYEbLrYbxiDP5Za03bjGy+YltHonFZr4FnrIAw0ppmbLFeA9ATUixHXl/V6IWA+89uYf YNpz7A0cB8wuBpLd9mFqxKsN3GExQk31QupR0Y8OaONRTyeHUu4GlhVPaqEdHw/8z+hO LcN1ywrZpdHkxlhMbWDXQ8tXj+Ww8MLesBMPb6f8MQcLjI6BuNUGH7n1BGbwCGSUbZu3 rj4TvS4NbOAt4YT19PlJ4aULf62aeg0CNW5s/5lG5wN2k+LJGZz50F4E7pRFUYqwMxp1 q+Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=s75UFnNaqV2x3ZRMCYd+xL6M6Iz2R7OBynTIzAOACow=; b=g8TI8q9aTjoMtUSCNJ9R7L5frv9rPYoaBxmxSu0jvKp7s6O/DGYmucFTkTic900vzN HUVtPXcxeaie7m+nyEl9/+Nn6l5u+9ecN1wtbfXMkLd5N49yNX1GKuiWPor4wcj6NA0p +ID/asSdZ98ULd7E6vI73NcD0CPUbXdHJutIL3fG/U5Lp9ekgadQGZgBqVzo8hVU1PLu 6j5EiKFn05X52BPB23RxH1tdVBNEUZ3Ih8uuKaoozaVt4BlDdfosIQVwxAeAfnV6vBkz PcmdMqI/ZX7tffQelFaDijoefJh4Q4zOu3oWdDnAwxN+xk5G+roYqnnimcThZ8RQmn6h l9kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AkUjoTHA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g92-v6si74236plg.256.2018.04.10.19.11.24; Tue, 10 Apr 2018 19:12:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AkUjoTHA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbeDKCIc (ORCPT + 99 others); Tue, 10 Apr 2018 22:08:32 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45661 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbeDKCIa (ORCPT ); Tue, 10 Apr 2018 22:08:30 -0400 Received: by mail-pg0-f65.google.com with SMTP id y63so72834pgy.12; Tue, 10 Apr 2018 19:08:30 -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=s75UFnNaqV2x3ZRMCYd+xL6M6Iz2R7OBynTIzAOACow=; b=AkUjoTHAeWhlYWQyAyZis0AB8B4W8D+WR3Hdx9NFOoJ44HzsQHnykJUK6GR5dyoxVh 41AmFOYem3onfmRSGOAJSVUhICoD2mVVa5QeIHGYwEM17IrZqwLGR4AGDq24N+Eb0/h1 Dl0omdOxlXkmAC5P5WGD9eoE3Sgo1GeSXDPJZSu5efOvTeissn4lRJo27/bS9QskHv0y ZU9Ly40pcik64dpJzS8F7jU1D05YgahSZB7eGY9RiUO5b1aIVnyv3UstSObkgfTqdIqe kBTcdVCG1ToSqqLAkzlWTC0LA1Uafsg/vIBuAT5hL6uBudtNnXGT6F54DFb4WMfbgLWd YKng== 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=s75UFnNaqV2x3ZRMCYd+xL6M6Iz2R7OBynTIzAOACow=; b=EN0j9j8OtRuJmC2Poa8SukmmbTu+pHQnJ4CXZzZUBJXQgLk8R0E+F/TuPEzqHVx3IO 7D0eswjDopUdyq6vQy3Pj//K+1HII7NT+1POhbRlxbOZPf9doahp6n7LzZoQG8WjCoIo kHQt4JITwgrr/1OhRhgiFm6ENcM2He8gaP2wYuT2gJVXscmuk9lI6/ZyHCcWJIHonGxe 8/Wptqcc8IyXlqr9WV+YGW1qkbZE3CrbJZb+ZjbYj40aL7vvkCJs2LZQ10xliV6/rfTe iZNs/iEyleU+lGBZk8Md6SHRA7e4vVJVveSIUz5xYF/QKKZthzUWJEorz4/Turo+Q2nk nE5A== X-Gm-Message-State: ALQs6tDd2rTlCBBR7VRzgMEZIfFnOlvQln6fnp1wD7hC+AVb8iT5EFZJ SwDZpo9Xr3DGw8pVzbon71A= X-Received: by 10.98.141.78 with SMTP id z75mr2338455pfd.174.1523412510286; Tue, 10 Apr 2018 19:08:30 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id b65sm88382pfl.145.2018.04.10.19.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:08:29 -0700 (PDT) From: Jia-Ju Bai To: jeffrey.t.kirsher@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] intel: i40evf: Replace GFP_ATOMIC with GFP_KERNEL in i40evf_add_vlan Date: Wed, 11 Apr 2018 10:08:18 +0800 Message-Id: <1523412498-2177-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org i40evf_add_vlan() is never called in atomic context. i40evf_add_vlan() is only called by i40evf_vlan_rx_add_vid(), which is only set as ".ndo_vlan_rx_add_vid" in struct net_device_ops. ".ndo_vlan_rx_add_vid" is not called in atomic context. Despite never getting called from atomic context, i40evf_add_vlan() 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 --- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index 1825d95..04b2b9c 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c @@ -770,7 +770,7 @@ i40evf_vlan_filter *i40evf_add_vlan(struct i40evf_adapter *adapter, u16 vlan) f = i40evf_find_vlan(adapter, vlan); if (!f) { - f = kzalloc(sizeof(*f), GFP_ATOMIC); + f = kzalloc(sizeof(*f), GFP_KERNEL); if (!f) goto clearout; -- 1.9.1