net_sched: fix use of uninitialized ethertype variable in cls_flower
authorArnd Bergmann <arnd@arndb.de>
Fri, 26 Aug 2016 15:25:45 +0000 (17:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Aug 2016 04:30:23 +0000 (00:30 -0400)
commit0b498a52778368ff501557d68c7b50878ab1701e
tree1288212b68e9e981fa7ea21656aaf13d75ed3ee5
parentf9dc70744dc74bc9e128d579f2bc85eb7c0ad8ce
net_sched: fix use of uninitialized ethertype variable in cls_flower

The addition of VLAN support caused a possible use of uninitialized
data if we encounter a zero TCA_FLOWER_KEY_ETH_TYPE key, as pointed
out by "gcc -Wmaybe-uninitialized":

net/sched/cls_flower.c: In function 'fl_change':
net/sched/cls_flower.c:366:22: error: 'ethertype' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This changes the code to only set the ethertype field if it
was nonzero, as before the patch.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9399ae9a6cb2 ("net_sched: flower: Add vlan support")
Cc: Hadar Hen Zion <hadarh@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_flower.c