netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] atm: firestream: Replace GFP_ATOMIC with GFP_KERNEL in fs_send
@ 2018-01-26  8:00 Jia-Ju Bai
  2018-01-26 12:05 ` Al Viro
  0 siblings, 1 reply; 10+ messages in thread
From: Jia-Ju Bai @ 2018-01-26  8:00 UTC (permalink / raw)
  To: 3chas3; +Cc: linux-atm-general, netdev, linux-kernel, Jia-Ju Bai

After checking all possible call chains to fs_send() here,
my tool finds that fs_send() is never called in atomic context.
And this function is assigned to a function pointer "dev->ops->send",
which is only called by vcc_sendmsg() (net/atm/common.c)
through vcc->dev->ops->send(), and vcc_sendmsg() calls schedule(),
it indicates that fs_send() can call functions which may sleep.
Thus GFP_ATOMIC is not necessary, and it 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 <baijiaju1990@gmail.com>
---
 drivers/atm/firestream.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index d97c056..cce6f9f 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1184,7 +1184,7 @@ static int fs_send (struct atm_vcc *atm_vcc, struct sk_buff *skb)
 
 	vcc->last_skb = skb;
 
-	td = kmalloc (sizeof (struct FS_BPENTRY), GFP_ATOMIC);
+	td = kmalloc (sizeof (struct FS_BPENTRY), GFP_KERNEL);
 	fs_dprintk (FS_DEBUG_ALLOC, "Alloc transd: %p(%zd)\n", td, sizeof (struct FS_BPENTRY));
 	if (!td) {
 		/* Oops out of mem */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-01-27  4:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-26  8:00 [PATCH] atm: firestream: Replace GFP_ATOMIC with GFP_KERNEL in fs_send Jia-Ju Bai
2018-01-26 12:05 ` Al Viro
2018-01-26 13:56   ` Jia-Ju Bai
2018-01-26 14:17     ` Jia-Ju Bai
2018-01-26 16:10       ` David Miller
2018-01-26 16:10     ` David Miller
2018-01-26 16:07   ` David Miller
2018-01-26 16:17     ` Jia-Ju Bai
2018-01-26 17:08     ` Al Viro
2018-01-27  4:09       ` Jia-Ju Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).