Skip to content

Commit f77cdee

Browse files
Edwin Peerkuba-moo
authored andcommitted
bnxt_en: resize bnxt_irq name field to fit format string
The name field of struct bnxt_irq is written using snprintf in bnxt_setup_msix(). Make the field large enough to fit the maximal formatted string to prevent truncation. Truncated IRQ names are less meaningful to the user. For example, "enp4s0f0np0-TxRx-0" gets truncated to "enp4s0f0np0-TxRx-" with the existing code. Make sure we have space for the extra characters added to the IRQ names: - the characters introduced by the static format string: hyphens - the maximal static substituted ring type string: "TxRx" - the maximum length of an integer formatted as a string, even though reasonable ring numbers would never be as long as this. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20240909202737.93852-4-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2d51eb0 commit f77cdee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • drivers/net/ethernet/broadcom/bnxt

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,12 +1217,15 @@ struct bnxt_napi {
12171217
bool in_reset;
12181218
};
12191219

1220+
/* "TxRx", 2 hypens, plus maximum integer */
1221+
#define BNXT_IRQ_NAME_EXTRA 17
1222+
12201223
struct bnxt_irq {
12211224
irq_handler_t handler;
12221225
unsigned int vector;
12231226
u8 requested:1;
12241227
u8 have_cpumask:1;
1225-
char name[IFNAMSIZ + 2];
1228+
char name[IFNAMSIZ + BNXT_IRQ_NAME_EXTRA];
12261229
cpumask_var_t cpu_mask;
12271230
};
12281231

0 commit comments

Comments
 (0)