]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/rtrs: Fix some signedness bugs in error handling
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 19 May 2020 13:32:23 +0000 (16:32 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 19 May 2020 23:40:20 +0000 (20:40 -0300)
commitc8ecdc2fb79a3a75018e74651347e706f6780329
treea128fe4630cbba6c7e18c8492a06aaae30a9b477
parent4529b42ed5ef8c5d1f4b9c31126ee3c352a03f28
RDMA/rtrs: Fix some signedness bugs in error handling

The problem is that "req->sg_cnt" is an unsigned int so if "nr" is
negative, it gets type promoted to a high positive value and the condition
is false.  This patch fixes it by handling negatives separately.

Fixes: abff70da8ae0 ("RDMA/rtrs: client: main functionality")
Link: https://lore.kernel.org/r/20200519133223.GN2078@kadam
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/ulp/rtrs/rtrs-clt.c
drivers/infiniband/ulp/rtrs/rtrs-srv.c