* [PATCH] tty: n_gsm: Debug output allocation must use GFP_ATOMIC
@ 2022-05-23 15:50 Tony Lindgren
2022-05-25 13:32 ` Gregory CLEMENT
0 siblings, 1 reply; 2+ messages in thread
From: Tony Lindgren @ 2022-05-23 15:50 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Daniel Starke, Gregory CLEMENT, Jiri Slaby, Johan Hovold,
Zhenguo Zhao, linux-serial, linux-kernel, Dan Carpenter
Dan Carpenter <dan.carpenter@oracle.com> reported the following Smatch
warning:
drivers/tty/n_gsm.c:720 gsm_data_kick()
warn: sleeping in atomic context
This is because gsm_control_message() is holding a spin lock so
gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL.
Fixes: 925ea0fa5277 ("tty: n_gsm: Fix packet data hex dump output")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/tty/n_gsm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -459,7 +459,7 @@ static void gsm_hex_dump_bytes(const char *fname, const u8 *data,
return;
}
- prefix = kasprintf(GFP_KERNEL, "%s: ", fname);
+ prefix = kasprintf(GFP_ATOMIC, "%s: ", fname);
if (!prefix)
return;
print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
--
2.36.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tty: n_gsm: Debug output allocation must use GFP_ATOMIC
2022-05-23 15:50 [PATCH] tty: n_gsm: Debug output allocation must use GFP_ATOMIC Tony Lindgren
@ 2022-05-25 13:32 ` Gregory CLEMENT
0 siblings, 0 replies; 2+ messages in thread
From: Gregory CLEMENT @ 2022-05-25 13:32 UTC (permalink / raw)
To: Tony Lindgren, Greg Kroah-Hartman
Cc: Daniel Starke, Jiri Slaby, Johan Hovold, Zhenguo Zhao,
linux-serial, linux-kernel, Dan Carpenter
Tony Lindgren <tony@atomide.com> writes:
> Dan Carpenter <dan.carpenter@oracle.com> reported the following Smatch
> warning:
>
> drivers/tty/n_gsm.c:720 gsm_data_kick()
> warn: sleeping in atomic context
>
> This is because gsm_control_message() is holding a spin lock so
> gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL.
>
> Fixes: 925ea0fa5277 ("tty: n_gsm: Fix packet data hex dump output")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
> drivers/tty/n_gsm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -459,7 +459,7 @@ static void gsm_hex_dump_bytes(const char *fname, const u8 *data,
> return;
> }
>
> - prefix = kasprintf(GFP_KERNEL, "%s: ", fname);
> + prefix = kasprintf(GFP_ATOMIC, "%s: ", fname);
> if (!prefix)
> return;
> print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
> --
> 2.36.1
--
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-25 13:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 15:50 [PATCH] tty: n_gsm: Debug output allocation must use GFP_ATOMIC Tony Lindgren
2022-05-25 13:32 ` Gregory CLEMENT
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).