net: hns: dereference ppe_cb->ppe_common_cb if it is non-null
authorColin Ian King <colin.king@canonical.com>
Thu, 25 Aug 2016 06:51:10 +0000 (07:51 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Aug 2016 18:44:56 +0000 (11:44 -0700)
commitc234af5875ffeab39d5a2c4230a477a35987a484
tree71c260650893c3699eb475d81b5c7a9708ebd200
parentb628d611a2a53858263fc419dba552f32431dba4
net: hns: dereference ppe_cb->ppe_common_cb if it is non-null

ppe_cb->ppe_common_cb is being dereferenced before a null check is
being made on it.  If ppe_cb->ppe_common_cb is null then we end up
with a null pointer dereference when assigning dsaf_dev.  Fix this
by moving the initialisation of dsaf_dev once we know
ppe_cb->ppe_common_cb is OK to dereference.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c