diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2018-04-10 04:31:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-23 04:57:06 -0400 |
commit | 13eac05b0581e6f9f5aec93a8ab64c83d7c311bf (patch) | |
tree | 1d4fc86945ab00c78c598cf7930d30555ca7c53f | |
parent | 5909c0bf9c7a17c52cf357bf5e752a76b8d72568 (diff) |
tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create
ipwireless_network_create() is never called in atomic context.
The call chain ending up at ipwireless_network_create() is:
[1] ipwireless_network_create() <- config_ipwireless() <-
ipwireless_attach()
ipwireless_attach() is only set as ".probe" in struct pcmcia_driver.
Despite never getting called from atomic context,
ipwireless_network_create() 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 <baijiaju1990@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/ipwireless/network.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c index 695439c03147..cf20616340a1 100644 --- a/drivers/tty/ipwireless/network.c +++ b/drivers/tty/ipwireless/network.c | |||
@@ -416,7 +416,7 @@ void ipwireless_network_packet_received(struct ipw_network *network, | |||
416 | struct ipw_network *ipwireless_network_create(struct ipw_hardware *hw) | 416 | struct ipw_network *ipwireless_network_create(struct ipw_hardware *hw) |
417 | { | 417 | { |
418 | struct ipw_network *network = | 418 | struct ipw_network *network = |
419 | kzalloc(sizeof(struct ipw_network), GFP_ATOMIC); | 419 | kzalloc(sizeof(struct ipw_network), GFP_KERNEL); |
420 | 420 | ||
421 | if (!network) | 421 | if (!network) |
422 | return NULL; | 422 | return NULL; |