From patchwork Fri Jul 27 08:04:53 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: 950033 X-Patchwork-Delegate: jeffrey.t.kirsher@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="obFskZWg"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41cM2X2TNbz9s0n for ; Fri, 27 Jul 2018 18:05:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0626C88722; Fri, 27 Jul 2018 08:05:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JWvLaKz7vzNl; Fri, 27 Jul 2018 08:05:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 64FAD88713; Fri, 27 Jul 2018 08:05:03 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BEB6F1C2AD7 for ; Fri, 27 Jul 2018 08:05:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B833488CFF for ; Fri, 27 Jul 2018 08:05:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FqW2XI4SzXEb for ; Fri, 27 Jul 2018 08:05:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 6CE0388CF2 for ; Fri, 27 Jul 2018 08:05:01 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id k21-v6so1472328pff.11 for ; Fri, 27 Jul 2018 01:05:01 -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=xO8+QcS/sypcgqi50Iq0IApJl+12RbGbr6B6n84+oh0=; b=obFskZWgZgCKI3cJfcA9T3XrCEHvk43AGXpzEifmIAo9m+LW/nh2EYtegacwAFn8d1 ptGd2WthkQ0HHiDEADfW26grTyVTRyrRIpttEbWpj2VqdCIXMc8geiyEVJALKwqsUMOh pwObEXu2+3NBamSXuj27EM3Uihq8mfc3qoaFfSz5Nx+AugEm4QneCjfGwVRcAusPWO28 xxF1qtibxWW6wEFapG7KDqX4egfprvfOx1sNZDOS5xAqit+HfkaY9KLGVq6ADOVsU/3S zr62ZJfFUJUuX3OBbdajbc7JaMbrlSdRJyYobSHGNEzrldt6dOzg4PdqWzimt/Ps7ST8 ptPg== 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=xO8+QcS/sypcgqi50Iq0IApJl+12RbGbr6B6n84+oh0=; b=EV+rOcd90jztAdteXoNVRc1C+MWBWO/X4cmuKPIpMDj8js4kEGgWHpS+kWy53pTgsl sOA39nSxPyMbu8OZgX3/gON3i+VKk7zfNklAUh0RviMSPJwQAxAGM6kDdLwoGhvhCm14 CHqX6M8JWwSDqzQV2uxKqlATisekpuQmK3QkshIEnX8FSP70x2yWPExv0jiMA7MGyTMI J8ChM0JR03+++8Ib5B3kTuO4vfCmacJpj4iL7bE+0s0l6WKe/qoqz85SawW4ohN8XTCo V734t74jR3HJY0w4gQ6ZdO8S2IKhLNPnXsL3FYamqkcR2SWC39k7yxPTS4idqap9AGeO 8hfA== X-Gm-Message-State: AOUpUlG6T9O9gGW9h8Z398vsB+RZS6TWdJuelQ8Lr/biv2Hw6K5WoclV uyNXke6Iu4PzNDfjFQo5mMg= X-Google-Smtp-Source: AAOMgpc1njOMZg0VfBtiDGC4BHqFU87rrLqr6EIVtUtxbIL0hSq1NLGWhOvIb5P+MCJcfCFqKWQg3w== X-Received: by 2002:a62:229a:: with SMTP id p26-v6mr5590454pfj.53.1532678701099; Fri, 27 Jul 2018 01:05:01 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id x24-v6sm5254978pfh.67.2018.07.27.01.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 01:05:00 -0700 (PDT) From: Jia-Ju Bai To: jeffrey.t.kirsher@intel.com Date: Fri, 27 Jul 2018 16:04:53 +0800 Message-Id: <20180727080453.3198-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Subject: [Intel-wired-lan] [PATCH 1/2] net: intel: igb: Replace GFP_ATOMIC with GFP_KERNEL in igb_sw_init() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Jia-Ju Bai , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" igb_sw_init() is never called in atomic context. It calls kzalloc() and kcalloc() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai Tested-by: Aaron Brown --- drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index cce7ada89255..5332a1b608e6 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3534,7 +3534,7 @@ static int igb_sw_init(struct igb_adapter *adapter) adapter->flags |= IGB_FLAG_HAS_MSIX; adapter->mac_table = kzalloc(sizeof(struct igb_mac_addr) * - hw->mac.rar_entry_count, GFP_ATOMIC); + hw->mac.rar_entry_count, GFP_KERNEL); if (!adapter->mac_table) return -ENOMEM; @@ -3544,7 +3544,7 @@ static int igb_sw_init(struct igb_adapter *adapter) /* Setup and initialize a copy of the hw vlan table array */ adapter->shadow_vfta = kcalloc(E1000_VLAN_FILTER_TBL_SIZE, sizeof(u32), - GFP_ATOMIC); + GFP_KERNEL); if (!adapter->shadow_vfta) return -ENOMEM;