[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1523283067-25697-1-git-send-email-baijiaju1990@gmail.com>
Date: Mon, 9 Apr 2018 22:11:07 +0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: davem@...emloft.net, arnd@...db.de, sam@...dozajonas.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] net: nsci: Replace GFP_ATOMIC with GFP_KERNEL in ncsi_register_dev
ncsi_register_dev() is never called in atomic context.
This function is only called by ftgmac100_probe() in
drivers/net/ethernet/faraday/ftgmac100.c.
And ftgmac100_probe() is only set as ".probe" in "struct platform_driver".
Despite never getting called from atomic context,
ncsi_register_dev() calls kzalloc() with GFP_ATOMIC,
which waits busily for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
to avoid busy waiting 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 <baijiaju1990@...il.com>
---
net/ncsi/ncsi-manage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 3fd3c39..6b5b5a0 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1508,7 +1508,7 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev,
return nd;
/* Create NCSI device */
- ndp = kzalloc(sizeof(*ndp), GFP_ATOMIC);
+ ndp = kzalloc(sizeof(*ndp), GFP_KERNEL);
if (!ndp)
return NULL;
--
1.9.1
Powered by blists - more mailing lists