Coverity: __rds_rdma_map(): Null pointer dereferences

From: coverity-bot
Date: Thu Mar 07 2024 - 14:32:52 EST


Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20240307 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

Wed Mar 6 11:58:42 2024 +0000
c055fc00c07b ("net/rds: fix WARNING in rds_conn_connect_if_down")

Coverity reported the following:

*** CID 1584247: Null pointer dereferences (FORWARD_NULL)
net/rds/rdma.c:306 in __rds_rdma_map()
300 unpin_user_pages(pages, nr_pages);
301 kfree(sg);
302 }
303 ret = PTR_ERR(trans_private);
304 /* Trigger connection so that its ready for the next retry */
305 if (ret == -ENODEV)
vvv CID 1584247: Null pointer dereferences (FORWARD_NULL)
vvv Dereferencing null pointer "cp".
306 rds_conn_connect_if_down(cp->cp_conn);
307 goto out;
308 }
309
310 mr->r_trans_private = trans_private;
311

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
Addresses-Coverity-ID: 1584247 ("Null pointer dereferences")
Fixes: c055fc00c07b ("net/rds: fix WARNING in rds_conn_connect_if_down")

Thanks for your attention!

--
Coverity-bot