Skip to content

Commit c33b3b9

Browse files
GustavoARSilvadavem330
authored andcommitted
cxgb3: remove VLA usage
Remove VLA usage and change the 'len' argument to a u8 and use a 256 byte buffer on the stack. Notice that these lengths are limited by the encoding field in the VPD structure, which is a u8 [1]. [1] https://marc.info/?l=linux-netdev&m=152044354814024&w=2 Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 334e641 commit c33b3b9

File tree

1 file changed

+4
-4
lines changed
  • drivers/net/ethernet/chelsio/cxgb3

1 file changed

+4
-4
lines changed

drivers/net/ethernet/chelsio/cxgb3/t3_hw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,18 +681,18 @@ int t3_seeprom_wp(struct adapter *adapter, int enable)
681681
return t3_seeprom_write(adapter, EEPROM_STAT_ADDR, enable ? 0xc : 0);
682682
}
683683

684-
static int vpdstrtouint(char *s, int len, unsigned int base, unsigned int *val)
684+
static int vpdstrtouint(char *s, u8 len, unsigned int base, unsigned int *val)
685685
{
686-
char tok[len + 1];
686+
char tok[256];
687687

688688
memcpy(tok, s, len);
689689
tok[len] = 0;
690690
return kstrtouint(strim(tok), base, val);
691691
}
692692

693-
static int vpdstrtou16(char *s, int len, unsigned int base, u16 *val)
693+
static int vpdstrtou16(char *s, u8 len, unsigned int base, u16 *val)
694694
{
695-
char tok[len + 1];
695+
char tok[256];
696696

697697
memcpy(tok, s, len);
698698
tok[len] = 0;

0 commit comments

Comments
 (0)