Re: [axboe-block:for-6.10/io_uring 42/42] io_uring/register.c:175:24: warning: arithmetic between different enumeration types ('enum io_uring_register_restriction_op' and 'enum io_uring_register_op')

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

 



On 3/29/24 4:04 PM, Gabriel Krisman Bertazi wrote:
> kernel test robot <lkp@xxxxxxxxx> writes:
> 
> [+ io_uring list ]
> 
>>>> io_uring/register.c:175:24: warning: arithmetic between different
>> enumeration types ('enum io_uring_register_restriction_op' and 'enum
>> io_uring_register_op') [-Wenum-enum-conversion]
>>      175 |         if (!arg || nr_args > IORING_MAX_RESTRICTIONS)
>>          |                               ^~~~~~~~~~~~~~~~~~~~~~~
>>    io_uring/register.c:31:58: note: expanded from macro 'IORING_MAX_RESTRICTIONS'
>>       31 | #define IORING_MAX_RESTRICTIONS (IORING_RESTRICTION_LAST + \
>>          |                                  ~~~~~~~~~~~~~~~~~~~~~~~ ^
>>       32 |                                  IORING_REGISTER_LAST + IORING_OP_LAST)
>>          |                                  ~~~~~~~~~~~~~~~~~~~~
>>    14 warnings generated.
> 
> hm.
> 
> Do we want to fix?  The arithmetic is safe here.  I actually tried
> triggering the warning with gcc, but even with -Wenum-conversion in
> gcc-12 (which is in -Wextra and we don't use in the kernel build), I
> couldn't do it.  only llvm catches this.
> 
> can we explicit cast to int to silent it?

I don't think we care, there are others like it in the kernel already.
Plus you need some magic warning incantation to hit it, clang by default
is not going to be enough.

-- 
Jens Axboe





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux