RDMA/hns: Prevent undefined behavior in hns_roce_set_user_sq_size()
The "ucmd->log_sq_bb_count" variable is a user controlled variable in the 0-255 range. If we shift more than then number of bits in an int then it's undefined behavior (it shift wraps), and potentially the int could become negative. Fixes: 9a443537 ("IB/hns: Add driver files for hns RoCE driver") Link: https://lore.kernel.org/r/20190608092514.GC28890@mwandaReported-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NJason Gunthorpe <jgg@mellanox.com> Reviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
Showing
想要评论请 注册 或 登录