Commit fb94f260 authored by wangsirong's avatar wangsirong Committed by Zheng Zengkai
Browse files

RDMA/hns: Add a check to ensure integer mtu is positive

mainline inclusion
from mainline-v5.12-rc1
commit fe331da0
category: bugfix
bugzilla: 174002
CVE:NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fe331da0f210c60342b042a03fe53f1b564b412b

----------------------------------------------------------------------

    GCC may reports an running time assert error when a value calculated from
    ib_mtu_enum_to_int() is using as 'val' in FIELD_PREDP:

    include/linux/compiler_types.h:328:38: error: call to
    '__compiletime_assert_1524' declared with attribute error: FIELD_PREP:
    value too large for the field

    So a check is added about whether integer mtu from ib_mtu_enum_to_int() is
    negative to avoid this warning.

    Link: https://lore.kernel.org/r/1624262443-24528-3-git-send-email-liweihang@huawei.com


    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Signed-off-by: default avatarWeihang Li <liweihang@huawei.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>

Reviewed-by: default avatarChunZhi Hu <huchunzhi@huawei.com>

Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 09a41ab0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment