net: hinic: fix null pointer dereference on pointer hwdev
authorColin Ian King <colin.king@canonical.com>
Thu, 22 Nov 2018 10:05:01 +0000 (10:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 24 Nov 2018 01:22:02 +0000 (17:22 -0800)
commite159e592872edc0536f55ec242dbc5b70a593265
tree506b7ee61c3e681b8633d3c386ac55f873d4007f
parentb0c4b041e37c7972f42349cb75a1dab68f234b5b
net: hinic: fix null pointer dereference on pointer hwdev

Pointer hwdev is being dereferenced when declaring hwif , however, later
on hwdev is being null checked, hence we have dereference before null
check error. Fix this by assigning hwif and pdef only once hwdev has
been null checked.

Detected by CoverityScan, CID#1485581 ("Dereference before null check")

Fixes: 4a61abb100c8 ("net-next/hinic:add rx checksum offload for HiNIC")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/huawei/hinic/hinic_port.c