* [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings
@ 2025-04-15 11:29 Peter Seiderer
2025-04-15 11:29 ` [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}') Peter Seiderer
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Peter Seiderer @ 2025-04-15 11:29 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
Peter Seiderer
Fix checkpatch detected code style errors/warnings detected in
the file net/core/pktgen.c (remaining checkpatch checks will be addressed
in a follow up patch set).
Changes v1 -> v2:
- drop already applied patches
- update "net: pktgen: fix code style (ERROR: else should follow close brace
'}')"
Additional add braces around the else statement (as suggested by a follow
up checkpatch run and by Jakub Kicinski from code review).
- update "net: pktgen: fix code style (WARNING: please, no space before tabs)"
Change from spaces to tab for indent (suggested by Jakub Kicinski).
- update "net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy)"
Squash memset/strscpy pattern into single strscpy_pad call (suggested
by Jakub Kicinski).
- drop "net: pktgen: fix code style (WARNING: braces {} are not necessary for
single statement blocks)" (suggestd by Jakub Kicinski)
Peter Seiderer (3):
net: pktgen: fix code style (ERROR: else should follow close brace
'}')
net: pktgen: fix code style (WARNING: please, no space before tabs)
net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy)
net/core/pktgen.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}')
2025-04-15 11:29 [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings Peter Seiderer
@ 2025-04-15 11:29 ` Peter Seiderer
2025-04-16 17:18 ` Simon Horman
2025-04-15 11:29 ` [PATCH net-next v2 2/3] net: pktgen: fix code style (WARNING: please, no space before tabs) Peter Seiderer
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Peter Seiderer @ 2025-04-15 11:29 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
Peter Seiderer
Fix checkpatch code style errors:
ERROR: else should follow close brace '}'
#1317: FILE: net/core/pktgen.c:1317:
+ }
+ else
And checkpatch follow up code style check:
CHECK: Unbalanced braces around else statement
#1316: FILE: net/core/pktgen.c:1316:
+ } else
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v1 -> v2:
- Additional add braces around the else statement (as suggested by a follow
up checkpatch run and by Jakub Kicinski from code review).
---
net/core/pktgen.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fa30ff0f2464..21206a567843 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1313,9 +1313,9 @@ static ssize_t pktgen_if_write(struct file *file,
put_page(pkt_dev->page);
pkt_dev->page = NULL;
}
- }
- else
+ } else {
sprintf(pg_result, "ERROR: node not possible");
+ }
return count;
}
if (!strcmp(name, "xmit_mode")) {
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next v2 2/3] net: pktgen: fix code style (WARNING: please, no space before tabs)
2025-04-15 11:29 [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings Peter Seiderer
2025-04-15 11:29 ` [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}') Peter Seiderer
@ 2025-04-15 11:29 ` Peter Seiderer
2025-04-16 17:18 ` Simon Horman
2025-04-15 11:29 ` [PATCH net-next v2 3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy) Peter Seiderer
2025-04-17 11:20 ` [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings patchwork-bot+netdevbpf
3 siblings, 1 reply; 8+ messages in thread
From: Peter Seiderer @ 2025-04-15 11:29 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
Peter Seiderer
Fix checkpatch code style warnings:
WARNING: please, no space before tabs
#230: FILE: net/core/pktgen.c:230:
+#define M_NETIF_RECEIVE ^I1^I/* Inject packets into stack */$
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v1 -> v2:
- change from spaces to tab for indent (suggested by Jakub Kicinski)
---
net/core/pktgen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 21206a567843..9d56f9765411 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -227,7 +227,7 @@ static char *pkt_flag_names[] = {
/* Xmit modes */
#define M_START_XMIT 0 /* Default normal TX */
-#define M_NETIF_RECEIVE 1 /* Inject packets into stack */
+#define M_NETIF_RECEIVE 1 /* Inject packets into stack */
#define M_QUEUE_XMIT 2 /* Inject packet into qdisc */
/* If lock -- protects updating of if_list */
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next v2 3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy)
2025-04-15 11:29 [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings Peter Seiderer
2025-04-15 11:29 ` [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}') Peter Seiderer
2025-04-15 11:29 ` [PATCH net-next v2 2/3] net: pktgen: fix code style (WARNING: please, no space before tabs) Peter Seiderer
@ 2025-04-15 11:29 ` Peter Seiderer
2025-04-16 17:18 ` Simon Horman
2025-04-17 11:20 ` [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings patchwork-bot+netdevbpf
3 siblings, 1 reply; 8+ messages in thread
From: Peter Seiderer @ 2025-04-15 11:29 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Toke Høiland-Jørgensen,
Peter Seiderer
Fix checkpatch code style warnings:
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#1423: FILE: net/core/pktgen.c:1423:
+ strcpy(pkt_dev->dst_min, buf);
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#1444: FILE: net/core/pktgen.c:1444:
+ strcpy(pkt_dev->dst_max, buf);
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#1554: FILE: net/core/pktgen.c:1554:
+ strcpy(pkt_dev->src_min, buf);
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#1575: FILE: net/core/pktgen.c:1575:
+ strcpy(pkt_dev->src_max, buf);
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#3231: FILE: net/core/pktgen.c:3231:
+ strcpy(pkt_dev->result, "Starting");
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#3235: FILE: net/core/pktgen.c:3235:
+ strcpy(pkt_dev->result, "Error starting");
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
#3849: FILE: net/core/pktgen.c:3849:
+ strcpy(pkt_dev->odevname, ifname);
While at it squash memset/strcpy pattern into single strscpy_pad call.
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v1 -> v2:
- squash memset/strscpy pattern into single strscpy_pad call (suggested
by Jakub Kicinski)
---
net/core/pktgen.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 9d56f9765411..0ebe5461d4d9 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1419,8 +1419,7 @@ static ssize_t pktgen_if_write(struct file *file,
return -EFAULT;
buf[len] = 0;
if (strcmp(buf, pkt_dev->dst_min) != 0) {
- memset(pkt_dev->dst_min, 0, sizeof(pkt_dev->dst_min));
- strcpy(pkt_dev->dst_min, buf);
+ strscpy_pad(pkt_dev->dst_min, buf);
pkt_dev->daddr_min = in_aton(pkt_dev->dst_min);
pkt_dev->cur_daddr = pkt_dev->daddr_min;
}
@@ -1440,8 +1439,7 @@ static ssize_t pktgen_if_write(struct file *file,
return -EFAULT;
buf[len] = 0;
if (strcmp(buf, pkt_dev->dst_max) != 0) {
- memset(pkt_dev->dst_max, 0, sizeof(pkt_dev->dst_max));
- strcpy(pkt_dev->dst_max, buf);
+ strscpy_pad(pkt_dev->dst_max, buf);
pkt_dev->daddr_max = in_aton(pkt_dev->dst_max);
pkt_dev->cur_daddr = pkt_dev->daddr_max;
}
@@ -1550,8 +1548,7 @@ static ssize_t pktgen_if_write(struct file *file,
return -EFAULT;
buf[len] = 0;
if (strcmp(buf, pkt_dev->src_min) != 0) {
- memset(pkt_dev->src_min, 0, sizeof(pkt_dev->src_min));
- strcpy(pkt_dev->src_min, buf);
+ strscpy_pad(pkt_dev->src_min, buf);
pkt_dev->saddr_min = in_aton(pkt_dev->src_min);
pkt_dev->cur_saddr = pkt_dev->saddr_min;
}
@@ -1571,8 +1568,7 @@ static ssize_t pktgen_if_write(struct file *file,
return -EFAULT;
buf[len] = 0;
if (strcmp(buf, pkt_dev->src_max) != 0) {
- memset(pkt_dev->src_max, 0, sizeof(pkt_dev->src_max));
- strcpy(pkt_dev->src_max, buf);
+ strscpy_pad(pkt_dev->src_max, buf);
pkt_dev->saddr_max = in_aton(pkt_dev->src_max);
pkt_dev->cur_saddr = pkt_dev->saddr_max;
}
@@ -3228,11 +3224,11 @@ static void pktgen_run(struct pktgen_thread *t)
set_pkt_overhead(pkt_dev);
- strcpy(pkt_dev->result, "Starting");
+ strscpy(pkt_dev->result, "Starting");
pkt_dev->running = 1; /* Cranke yeself! */
started++;
} else
- strcpy(pkt_dev->result, "Error starting");
+ strscpy(pkt_dev->result, "Error starting");
}
rcu_read_unlock();
if (started)
@@ -3846,7 +3842,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
if (!pkt_dev)
return -ENOMEM;
- strcpy(pkt_dev->odevname, ifname);
+ strscpy(pkt_dev->odevname, ifname);
pkt_dev->flows = vzalloc_node(array_size(MAX_CFLOWS,
sizeof(struct flow_state)),
node);
--
2.49.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}')
2025-04-15 11:29 ` [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}') Peter Seiderer
@ 2025-04-16 17:18 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2025-04-16 17:18 UTC (permalink / raw)
To: Peter Seiderer
Cc: netdev, linux-kernel, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Toke Høiland-Jørgensen
On Tue, Apr 15, 2025 at 01:29:14PM +0200, Peter Seiderer wrote:
> Fix checkpatch code style errors:
>
> ERROR: else should follow close brace '}'
> #1317: FILE: net/core/pktgen.c:1317:
> + }
> + else
>
> And checkpatch follow up code style check:
>
> CHECK: Unbalanced braces around else statement
> #1316: FILE: net/core/pktgen.c:1316:
> + } else
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
> Changes v1 -> v2:
> - Additional add braces around the else statement (as suggested by a follow
> up checkpatch run and by Jakub Kicinski from code review).
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 2/3] net: pktgen: fix code style (WARNING: please, no space before tabs)
2025-04-15 11:29 ` [PATCH net-next v2 2/3] net: pktgen: fix code style (WARNING: please, no space before tabs) Peter Seiderer
@ 2025-04-16 17:18 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2025-04-16 17:18 UTC (permalink / raw)
To: Peter Seiderer
Cc: netdev, linux-kernel, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Toke Høiland-Jørgensen
On Tue, Apr 15, 2025 at 01:29:15PM +0200, Peter Seiderer wrote:
> Fix checkpatch code style warnings:
>
> WARNING: please, no space before tabs
> #230: FILE: net/core/pktgen.c:230:
> +#define M_NETIF_RECEIVE ^I1^I/* Inject packets into stack */$
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy)
2025-04-15 11:29 ` [PATCH net-next v2 3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy) Peter Seiderer
@ 2025-04-16 17:18 ` Simon Horman
0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2025-04-16 17:18 UTC (permalink / raw)
To: Peter Seiderer
Cc: netdev, linux-kernel, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Toke Høiland-Jørgensen
On Tue, Apr 15, 2025 at 01:29:16PM +0200, Peter Seiderer wrote:
> Fix checkpatch code style warnings:
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #1423: FILE: net/core/pktgen.c:1423:
> + strcpy(pkt_dev->dst_min, buf);
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #1444: FILE: net/core/pktgen.c:1444:
> + strcpy(pkt_dev->dst_max, buf);
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #1554: FILE: net/core/pktgen.c:1554:
> + strcpy(pkt_dev->src_min, buf);
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #1575: FILE: net/core/pktgen.c:1575:
> + strcpy(pkt_dev->src_max, buf);
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #3231: FILE: net/core/pktgen.c:3231:
> + strcpy(pkt_dev->result, "Starting");
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #3235: FILE: net/core/pktgen.c:3235:
> + strcpy(pkt_dev->result, "Error starting");
>
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> #3849: FILE: net/core/pktgen.c:3849:
> + strcpy(pkt_dev->odevname, ifname);
>
> While at it squash memset/strcpy pattern into single strscpy_pad call.
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
> Changes v1 -> v2:
> - squash memset/strscpy pattern into single strscpy_pad call (suggested
> by Jakub Kicinski)
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings
2025-04-15 11:29 [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings Peter Seiderer
` (2 preceding siblings ...)
2025-04-15 11:29 ` [PATCH net-next v2 3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy) Peter Seiderer
@ 2025-04-17 11:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-17 11:20 UTC (permalink / raw)
To: Peter Seiderer
Cc: netdev, linux-kernel, davem, edumazet, kuba, pabeni, horms, toke
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 15 Apr 2025 13:29:13 +0200 you wrote:
> Fix checkpatch detected code style errors/warnings detected in
> the file net/core/pktgen.c (remaining checkpatch checks will be addressed
> in a follow up patch set).
>
> Changes v1 -> v2:
> - drop already applied patches
> - update "net: pktgen: fix code style (ERROR: else should follow close brace
> '}')"
> Additional add braces around the else statement (as suggested by a follow
> up checkpatch run and by Jakub Kicinski from code review).
> - update "net: pktgen: fix code style (WARNING: please, no space before tabs)"
> Change from spaces to tab for indent (suggested by Jakub Kicinski).
> - update "net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy)"
> Squash memset/strscpy pattern into single strscpy_pad call (suggested
> by Jakub Kicinski).
> - drop "net: pktgen: fix code style (WARNING: braces {} are not necessary for
> single statement blocks)" (suggestd by Jakub Kicinski)
>
> [...]
Here is the summary with links:
- [net-next,v2,1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}')
https://git.kernel.org/netdev/net-next/c/3bc1ca7e173c
- [net-next,v2,2/3] net: pktgen: fix code style (WARNING: please, no space before tabs)
https://git.kernel.org/netdev/net-next/c/65f5b9cb5431
- [net-next,v2,3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy)
https://git.kernel.org/netdev/net-next/c/422cf22aa332
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-04-17 11:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 11:29 [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings Peter Seiderer
2025-04-15 11:29 ` [PATCH net-next v2 1/3] net: pktgen: fix code style (ERROR: else should follow close brace '}') Peter Seiderer
2025-04-16 17:18 ` Simon Horman
2025-04-15 11:29 ` [PATCH net-next v2 2/3] net: pktgen: fix code style (WARNING: please, no space before tabs) Peter Seiderer
2025-04-16 17:18 ` Simon Horman
2025-04-15 11:29 ` [PATCH net-next v2 3/3] net: pktgen: fix code style (WARNING: Prefer strscpy over strcpy) Peter Seiderer
2025-04-16 17:18 ` Simon Horman
2025-04-17 11:20 ` [PATCH net-next v2 0/3] net: pktgen: fix checkpatch code style errors/warnings patchwork-bot+netdevbpf
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).