Re: [PATCH] RDMA/mlx4: Remove unnessesary check in mlx4_ib_modify_wq()

From: Jason Gunthorpe
Date: Tue May 11 2021 - 13:43:10 EST


On Fri, May 07, 2021 at 06:22:41PM +0800, Jiapeng Chong wrote:
> cur_state and new_state are enums and when GCC considers
> them as unsigned, the conditions are never met.

But doesn't gcc consider enums to be 'int' as the standard requires?

This change looks really sketchy to me, cur_state and new_state are
both userspace controlled data. We should not make assumptions about
the underlying signedness of an enum when validating user data.

Jason