* [PATCH RESEND] parport: replace kmalloc + strcpy with kstrdup in parse_data
@ 2026-05-04 18:10 Thorsten Blum
0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-05-04 18:10 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Thorsten Blum, linux-kernel
Replace kmalloc() followed by strcpy() with a single call to kstrdup()
to simplify parse_data().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/parport/probe.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
index 5d1b9aacb130..bf9d81c0abaf 100644
--- a/drivers/parport/probe.c
+++ b/drivers/parport/probe.c
@@ -52,7 +52,7 @@ static void pretty_print(struct parport *port, int device)
static void parse_data(struct parport *port, int device, char *str)
{
- char *txt = kmalloc(strlen(str)+1, GFP_KERNEL);
+ char *txt = kstrdup(str, GFP_KERNEL);
char *p = txt, *q;
int guessed_class = PARPORT_CLASS_UNSPEC;
struct parport_device_info *info = &port->probe_info[device + 1];
@@ -61,7 +61,6 @@ static void parse_data(struct parport *port, int device, char *str)
pr_warn("%s probe: memory squeeze\n", port->name);
return;
}
- strcpy(txt, str);
while (p) {
char *sep;
q = strchr(p, ';');
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH RESEND] parport: replace kmalloc + strcpy with kstrdup in parse_data
@ 2026-05-18 16:48 Thorsten Blum
2026-06-04 15:22 ` Thorsten Blum
0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2026-05-18 16:48 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Thorsten Blum, linux-kernel
Replace kmalloc() followed by strcpy() with a single call to kstrdup()
to simplify parse_data().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/parport/probe.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
index 5d1b9aacb130..bf9d81c0abaf 100644
--- a/drivers/parport/probe.c
+++ b/drivers/parport/probe.c
@@ -52,7 +52,7 @@ static void pretty_print(struct parport *port, int device)
static void parse_data(struct parport *port, int device, char *str)
{
- char *txt = kmalloc(strlen(str)+1, GFP_KERNEL);
+ char *txt = kstrdup(str, GFP_KERNEL);
char *p = txt, *q;
int guessed_class = PARPORT_CLASS_UNSPEC;
struct parport_device_info *info = &port->probe_info[device + 1];
@@ -61,7 +61,6 @@ static void parse_data(struct parport *port, int device, char *str)
pr_warn("%s probe: memory squeeze\n", port->name);
return;
}
- strcpy(txt, str);
while (p) {
char *sep;
q = strchr(p, ';');
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] parport: replace kmalloc + strcpy with kstrdup in parse_data
2026-05-18 16:48 [PATCH RESEND] parport: replace kmalloc + strcpy with kstrdup in parse_data Thorsten Blum
@ 2026-06-04 15:22 ` Thorsten Blum
0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-06-04 15:22 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: linux-kernel
Gentle ping?
On Mon, May 18, 2026 at 06:48:04PM +0200, Thorsten Blum wrote:
> Replace kmalloc() followed by strcpy() with a single call to kstrdup()
> to simplify parse_data().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/parport/probe.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
> index 5d1b9aacb130..bf9d81c0abaf 100644
> --- a/drivers/parport/probe.c
> +++ b/drivers/parport/probe.c
> @@ -52,7 +52,7 @@ static void pretty_print(struct parport *port, int device)
>
> static void parse_data(struct parport *port, int device, char *str)
> {
> - char *txt = kmalloc(strlen(str)+1, GFP_KERNEL);
> + char *txt = kstrdup(str, GFP_KERNEL);
> char *p = txt, *q;
> int guessed_class = PARPORT_CLASS_UNSPEC;
> struct parport_device_info *info = &port->probe_info[device + 1];
> @@ -61,7 +61,6 @@ static void parse_data(struct parport *port, int device, char *str)
> pr_warn("%s probe: memory squeeze\n", port->name);
> return;
> }
> - strcpy(txt, str);
> while (p) {
> char *sep;
> q = strchr(p, ';');
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-04 15:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18 16:48 [PATCH RESEND] parport: replace kmalloc + strcpy with kstrdup in parse_data Thorsten Blum
2026-06-04 15:22 ` Thorsten Blum
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 18:10 Thorsten Blum
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.