diff mbox series

[net-next] net: mvpp2: Increase size of queue_name buffer

Message ID 20240806-mvpp2-namelen-v1-1-6dc773653f2f@kernel.org (mailing list archive)
State Accepted
Commit 91d516d4de48532d967a77967834e00c8c53dfe6
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: mvpp2: Increase size of queue_name buffer | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 36 this patch: 35
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-06--15-00 (tests: 707)

Commit Message

Simon Horman Aug. 6, 2024, 11:28 a.m. UTC
Increase size of queue_name buffer from 30 to 31 to accommodate
the largest string written to it. This avoids truncation in
the possibly unlikely case where the string is name is the
maximum size.

Flagged by gcc-14:

  .../mvpp2_main.c: In function 'mvpp2_probe':
  .../mvpp2_main.c:7636:32: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
   7636 |                  "stats-wq-%s%s", netdev_name(priv->port_list[0]->dev),
        |                                ^
  .../mvpp2_main.c:7635:9: note: 'snprintf' output between 10 and 31 bytes into a destination of size 30
   7635 |         snprintf(priv->queue_name, sizeof(priv->queue_name),
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   7636 |                  "stats-wq-%s%s", netdev_name(priv->port_list[0]->dev),
        |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   7637 |                  priv->port_count > 1 ? "+" : "");
        |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Introduced by commit 118d6298f6f0 ("net: mvpp2: add ethtool GOP statistics").
I am not flagging this as a bug as I am not aware that it is one.

Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcin Wojtas Aug. 7, 2024, 9:12 p.m. UTC | #1
wt., 6 sie 2024 o 13:28 Simon Horman <horms@kernel.org> napisał(a):
>
> Increase size of queue_name buffer from 30 to 31 to accommodate
> the largest string written to it. This avoids truncation in
> the possibly unlikely case where the string is name is the
> maximum size.
>
> Flagged by gcc-14:
>
>   .../mvpp2_main.c: In function 'mvpp2_probe':
>   .../mvpp2_main.c:7636:32: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
>    7636 |                  "stats-wq-%s%s", netdev_name(priv->port_list[0]->dev),
>         |                                ^
>   .../mvpp2_main.c:7635:9: note: 'snprintf' output between 10 and 31 bytes into a destination of size 30
>    7635 |         snprintf(priv->queue_name, sizeof(priv->queue_name),
>         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    7636 |                  "stats-wq-%s%s", netdev_name(priv->port_list[0]->dev),
>         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    7637 |                  priv->port_count > 1 ? "+" : "");
>         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Introduced by commit 118d6298f6f0 ("net: mvpp2: add ethtool GOP statistics").
> I am not flagging this as a bug as I am not aware that it is one.
>
> Compile tested only.
>
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
>  drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
> index e809f91c08fb..9e02e4367bec 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
> @@ -1088,7 +1088,7 @@ struct mvpp2 {
>         unsigned int max_port_rxqs;
>
>         /* Workqueue to gather hardware statistics */
> -       char queue_name[30];
> +       char queue_name[31];
>         struct workqueue_struct *stats_queue;
>
>         /* Debugfs root entry */
>

Reviewed-by: Marcin Wojtas <marcin.s.wojtas@gmail.com>

Thanks!
patchwork-bot+netdevbpf@kernel.org Aug. 8, 2024, 3:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 06 Aug 2024 12:28:24 +0100 you wrote:
> Increase size of queue_name buffer from 30 to 31 to accommodate
> the largest string written to it. This avoids truncation in
> the possibly unlikely case where the string is name is the
> maximum size.
> 
> Flagged by gcc-14:
> 
> [...]

Here is the summary with links:
  - [net-next] net: mvpp2: Increase size of queue_name buffer
    https://git.kernel.org/netdev/net-next/c/91d516d4de48

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index e809f91c08fb..9e02e4367bec 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -1088,7 +1088,7 @@  struct mvpp2 {
 	unsigned int max_port_rxqs;
 
 	/* Workqueue to gather hardware statistics */
-	char queue_name[30];
+	char queue_name[31];
 	struct workqueue_struct *stats_queue;
 
 	/* Debugfs root entry */