* [bug report] i40iw: add connection management code
@ 2017-07-14 11:35 Dan Carpenter
2017-07-17 19:27 ` Shiraz Saleem
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-07-14 11:35 UTC (permalink / raw)
To: faisal.latif-ral2JQCrhuEAvxtiuMwx3w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Hello Faisal Latif,
This is a semi-automatic email about new static checker warnings.
The patch f27b4746f378: "i40iw: add connection management code" from
Jan 20, 2016, leads to the following Smatch complaint:
drivers/infiniband/hw/i40iw/i40iw_cm.c:3691 i40iw_accept()
error: we previously assumed 'cm_node->listener' could be null (see line 3689)
drivers/infiniband/hw/i40iw/i40iw_cm.c:4061 i40iw_cm_event_connected()
error: we previously assumed 'cm_node->listener' could be null (see line 4059)
drivers/infiniband/hw/i40iw/i40iw_cm.c
3688 if (cm_node->accept_pend) {
3689 if (!cm_node->listener)
^^^^^^^^^^^^^^^^^
Check
3690 i40iw_pr_err("cm_node->listener NULL for passive node\n");
3691 atomic_dec(&cm_node->listener->pend_accepts_cnt);
^^^^^^^^^^^^^^^^^
Unchecked dereference
3692 cm_node->accept_pend = 0;
3693 }
[ snip ]
4058 if (cm_node->accept_pend) {
4059 if (!cm_node->listener)
^^^^^^^^^^^^^^^^^
4060 i40iw_pr_err("listener is null for passive node\n");
4061 atomic_dec(&cm_node->listener->pend_accepts_cnt);
^^^^^^^^^^^^^^^^^
4062 cm_node->accept_pend = 0;
4063 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] i40iw: add connection management code
2017-07-14 11:35 [bug report] i40iw: add connection management code Dan Carpenter
@ 2017-07-17 19:27 ` Shiraz Saleem
0 siblings, 0 replies; 2+ messages in thread
From: Shiraz Saleem @ 2017-07-17 19:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: faisal.latif-ral2JQCrhuEAvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA
On Fri, Jul 14, 2017 at 02:35:14PM +0300, Dan Carpenter wrote:
> Hello Faisal Latif,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch f27b4746f378: "i40iw: add connection management code" from
> Jan 20, 2016, leads to the following Smatch complaint:
>
> drivers/infiniband/hw/i40iw/i40iw_cm.c:3691 i40iw_accept()
> error: we previously assumed 'cm_node->listener' could be null (see line 3689)
>
> drivers/infiniband/hw/i40iw/i40iw_cm.c:4061 i40iw_cm_event_connected()
> error: we previously assumed 'cm_node->listener' could be null (see line 4059)
>
Dan - Thank you for reporting.
The NULL check at 3689 is incorrect as we will always have
a listener at this point in i40iw_accept.
The code 4058-4063 also needs to be removed as we are in active node
context and cm_node->accept_pend is always 0.
We ll send a patch to fix this soon.
>
> drivers/infiniband/hw/i40iw/i40iw_cm.c
> 3688 if (cm_node->accept_pend) {
> 3689 if (!cm_node->listener)
> ^^^^^^^^^^^^^^^^^
> Check
>
> 3690 i40iw_pr_err("cm_node->listener NULL for passive node\n");
> 3691 atomic_dec(&cm_node->listener->pend_accepts_cnt);
> ^^^^^^^^^^^^^^^^^
> Unchecked dereference
>
> 3692 cm_node->accept_pend = 0;
> 3693 }
>
> [ snip ]
>
> 4058 if (cm_node->accept_pend) {
> 4059 if (!cm_node->listener)
> ^^^^^^^^^^^^^^^^^
> 4060 i40iw_pr_err("listener is null for passive node\n");
> 4061 atomic_dec(&cm_node->listener->pend_accepts_cnt);
> ^^^^^^^^^^^^^^^^^
> 4062 cm_node->accept_pend = 0;
> 4063 }
>
> regards,
> dan carpenter
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-17 19:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14 11:35 [bug report] i40iw: add connection management code Dan Carpenter
2017-07-17 19:27 ` Shiraz Saleem
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.