Skip to contentSkip to conversation

rdma/siw: connection management

bug report Dan Carpenter 2 participants 2 messages Aug 19, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

Hello Bernard Metzler,

This is a semi-automatic email about new static checker warnings.

The patch 6c52fdc244b5: "rdma/siw: connection management" from Jun 20, 2019, leads to the following Smatch complaint:

drivers/infiniband/sw/siw/siw_cm.c:1518 siw_connect()
error: we previously assumed 'qp' could be null (see line 1372)

drivers/infiniband/sw/siw/siw_cm.c
1371 qp = siw_qp_id2obj(sdev, params->qpn);

  1372		if (!qp) {
                    ^^^

NULL

  1373			WARN(1, "[QP %u] does not exist\n", params->qpn);
  1374			rv = -EINVAL;
  1375			goto error;
                        ^^^^^^^^^^

1376 }
1377 if (v4)
1378 siw_dbg_qp(qp,

[ snip ]

1508 if (rv >= 0) {
1509 rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT);
1510 if (!rv) {
1511 siw_dbg_cep(cep, "id 0x%p, [QP %u]: exit\n", id,
1512 qp_id(qp));
1513 siw_cep_set_free(cep);
1514 return 0;
1515 }
1516 }
1517 error:

  1518		siw_dbg_qp(qp, "failed: %d\n", rv);
                           ^^

NULL dereference.

  1519	
  1520		if (cep) {

regards,
dan carpenter

#1 lore raw

-----"Dan Carpenter" <[email protected]> wrote: -----

Quoted 43 lines

To: [email protected]
From: "Dan Carpenter" <[email protected]>
Date: 08/19/2019 02:12PM
Cc: [email protected]
Subject: [EXTERNAL] [bug report] rdma/siw: connection management

Hello Bernard Metzler,

This is a semi-automatic email about new static checker warnings.

The patch 6c52fdc244b5: "rdma/siw: connection management" from Jun 20, 2019, leads to the following Smatch complaint:

drivers/infiniband/sw/siw/siw_cm.c:1518 siw_connect()
error: we previously assumed 'qp' could be null (see line 1372)

drivers/infiniband/sw/siw/siw_cm.c
1371 qp = siw_qp_id2obj(sdev, params->qpn);

 1372		if (!qp) {
                   ^^^

NULL

1373 WARN(1, "[QP %u] does not exist\n", params->qpn);
1374 rv = -EINVAL;

 1375			goto error;
                       ^^^^^^^^^^

1376 }
1377 if (v4)
1378 siw_dbg_qp(qp,

[ snip ]

1508 if (rv >= 0) {
1509 rv = siw_cm_queue_work(cep, SIW_CM_WORK_MPATIMEOUT);
1510 if (!rv) {
1511 siw_dbg_cep(cep, "id 0x%p, [QP %u]: exit\n", id,
1512 qp_id(qp));
1513 siw_cep_set_free(cep);
1514 return 0;
1515 }
1516 }
1517 error:

Quoted 7 lines
 1518		siw_dbg_qp(qp, "failed: %d\n", rv);
                          ^^

NULL dereference.

1519
1520 if (cep) {

Thanks Dan!

A patch is on its way...

Bernard.

Quoted 4 lines

regards,
dan carpenter