Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c33b3b9f authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by David S. Miller
Browse files

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: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 334e6413
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -681,18 +681,18 @@ int t3_seeprom_wp(struct adapter *adapter, int enable)
	return t3_seeprom_write(adapter, EEPROM_STAT_ADDR, enable ? 0xc : 0);
}

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

	memcpy(tok, s, len);
	tok[len] = 0;
	return kstrtouint(strim(tok), base, val);
}

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

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