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

From: Leon Romanovsky
Date: Tue May 18 2021 - 03:05:54 EST


On Tue, May 11, 2021 at 02:43:02PM -0300, Jason Gunthorpe wrote:
> 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?

Ohh, I missed that.

>
> 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.

I still think that the right change should be in
ib_uverbs_ex_modify_wq(), so both mlx4 and mlx5 will be protected.

Thanks

>
> Jason