Re: [PATCH RESEND v2 for-next 1/7] RDMA/hns: Fix potential compile warnings on hr_reg_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 02, 2021 at 04:57:39PM +0800, Weihang Li wrote:
> From: Lang Cheng <chenglang@xxxxxxxxxx>
> 
> 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

Huh? This warning looks reliable to me, you should not suppress it
like this.

> But actually this error will still exists even if the driver can ensure
> that ib_mtu_enum_to_int() returns a legal value. So add a mask in
> hr_reg_write() to avoid above warning.

I think you need to have an if that ib_mtu_enum_to_int() is not
negative, that should satisfy the CFA?

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux