Commit ed40852
RDMA/rtrs-srv: Do not pass a valid pointer to PTR_ERR()
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/[email protected]
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>1 parent 2b5715f commit ed40852
1 file changed
+7
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1347 | 1347 | | |
1348 | 1348 | | |
1349 | 1349 | | |
| 1350 | + | |
1350 | 1351 | | |
1351 | 1352 | | |
1352 | 1353 | | |
1353 | 1354 | | |
1354 | | - | |
1355 | | - | |
| 1355 | + | |
1356 | 1356 | | |
1357 | | - | |
1358 | 1357 | | |
1359 | 1358 | | |
1360 | 1359 | | |
1361 | | - | |
1362 | | - | |
| 1360 | + | |
1363 | 1361 | | |
1364 | | - | |
1365 | 1362 | | |
1366 | 1363 | | |
1367 | 1364 | | |
| |||
1371 | 1368 | | |
1372 | 1369 | | |
1373 | 1370 | | |
1374 | | - | |
1375 | | - | |
1376 | 1371 | | |
1377 | 1372 | | |
1378 | 1373 | | |
| |||
1385 | 1380 | | |
1386 | 1381 | | |
1387 | 1382 | | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
1388 | 1386 | | |
1389 | 1387 | | |
1390 | 1388 | | |
| |||
1799 | 1797 | | |
1800 | 1798 | | |
1801 | 1799 | | |
1802 | | - | |
1803 | | - | |
1804 | | - | |
1805 | | - | |
1806 | | - | |
| 1800 | + | |
1807 | 1801 | | |
1808 | 1802 | | |
1809 | 1803 | | |
| |||
0 commit comments