Skip to content

Commit e8f967c

Browse files
arndbdavem330
authored andcommitted
mvpp2: use correct size for memset
gcc-7 detects a short memset in mvpp2, introduced in the original merge of the driver: drivers/net/ethernet/marvell/mvpp2.c: In function 'mvpp2_cls_init': drivers/net/ethernet/marvell/mvpp2.c:3296:2: error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size] The result seems to be that we write uninitialized data into the flow table registers, although we did not get any warning about that uninitialized data usage. Using sizeof() lets us initialize then entire array instead. Fixes: 3f51850 ("ethernet: Add new driver for Marvell Armada 375 network unit") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5e7dfeb commit e8f967c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/ethernet/marvell

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,7 @@ static void mvpp2_cls_init(struct mvpp2 *priv)
32933293
mvpp2_write(priv, MVPP2_CLS_MODE_REG, MVPP2_CLS_MODE_ACTIVE_MASK);
32943294

32953295
/* Clear classifier flow table */
3296-
memset(&fe.data, 0, MVPP2_CLS_FLOWS_TBL_DATA_WORDS);
3296+
memset(&fe.data, 0, sizeof(fe.data));
32973297
for (index = 0; index < MVPP2_CLS_FLOWS_TBL_SIZE; index++) {
32983298
fe.index = index;
32993299
mvpp2_cls_flow_write(priv, &fe);

0 commit comments

Comments
 (0)