]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: replace an unsuitable variable type in hclge_inform_reset_assert_to_vf()
authorHuazhong Tan <tanhuazhong@huawei.com>
Sat, 4 Jan 2020 02:49:30 +0000 (10:49 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 Jan 2020 21:26:25 +0000 (13:26 -0800)
commit95bf5a019121b8ffd8adf6a29a59102e33e01083
treea9e9f1370f629ebf36aa918a8bc9e4b17a7d5e61
parent3f55c571babc3d6542a7dafdf7a9ac76eabb96fe
net: hns3: replace an unsuitable variable type in hclge_inform_reset_assert_to_vf()

In hclge_inform_reset_assert_to_vf(), variable reset_type(enum type)
will be copied into msg_data whose size is 2 bytes. Currently, hip08
is a little-endian machine, so the lower two bytes of reset_type will
be copied to msg_data. But when running on a big-endian machine,
msg_data will have a wrong value(the higher two bytes of reset_type).

So this patch modifies the type of reset_type to u16, and adds a
build check in case enum hnae3_reset_type has value larger than
U16_MAX.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hnae3.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c