Repository navigation
Commit 248014a
RDMA/rtrs-srv: Do not pass a valid pointer to PTR_ERR()
[ Upstream commit ed40852 ]
smatch gives the warning:
drivers/infiniband/ulp/rtrs/rtrs-srv.c:1805 rtrs_rdma_connect() warn: passing zero to 'PTR_ERR'
Which is trying to say smatch has shown that srv is not an error pointer
and thus cannot be passed to PTR_ERR.
The solution is to move the list_add() down after full initilization of
rtrs_srv. To avoid holding the srv_mutex too long, only hold it during the
list operation as suggested by Leon.
Fixes: 03e9b33 ("RDMA/rtrs: Only allow addition of path to an already established session")
Link: https://lore.kernel.org/r/20210216143807.65923-1-jinpu.wang@cloud.ionos.com
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent d94d649 commit 248014a
1 file changed
Lines changed: 7 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1364 | 1364 | | |
1365 | 1365 | | |
1366 | 1366 | | |
| 1367 | + | |
1367 | 1368 | | |
1368 | 1369 | | |
1369 | 1370 | | |
1370 | 1371 | | |
1371 | | - | |
1372 | | - | |
| 1372 | + | |
1373 | 1373 | | |
1374 | | - | |
1375 | 1374 | | |
1376 | 1375 | | |
1377 | 1376 | | |
1378 | | - | |
1379 | | - | |
| 1377 | + | |
1380 | 1378 | | |
1381 | | - | |
1382 | 1379 | | |
1383 | 1380 | | |
1384 | 1381 | | |
| |||
1388 | 1385 | | |
1389 | 1386 | | |
1390 | 1387 | | |
1391 | | - | |
1392 | | - | |
1393 | 1388 | | |
1394 | 1389 | | |
1395 | 1390 | | |
| |||
1402 | 1397 | | |
1403 | 1398 | | |
1404 | 1399 | | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
1405 | 1403 | | |
1406 | 1404 | | |
1407 | 1405 | | |
| |||
1816 | 1814 | | |
1817 | 1815 | | |
1818 | 1816 | | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
| 1817 | + | |
1824 | 1818 | | |
1825 | 1819 | | |
1826 | 1820 | | |
| |||
0 commit comments