* [patch] RDMA/nes: checking for NULL instead of IS_ERR
@ 2016-01-12 9:27 Dan Carpenter
2016-01-12 15:12 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-01-12 9:27 UTC (permalink / raw)
To: Faisal Latif
Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, Christoph Hellwig,
linux-rdma, kernel-janitors
nes_reg_phys_mr() returns ERR_PTRs on error. It doesn't return NULL.
This bug has been there for a while, but we recently changed from
calling a function pointer to calling nes_reg_phys_mr() directly so now
Smatch is able to detect the bug.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 179490d..cb9f0f2 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -3320,14 +3320,14 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
nesqp->ietf_frame_pbase + mpa_frame_offset,
buff_len, IB_ACCESS_LOCAL_WRITE,
&tagged_offset);
- if (!ibmr) {
+ if (IS_ERR(ibmr)) {
nes_debug(NES_DBG_CM, "Unable to register memory region"
"for lSMM for cm_node = %p \n",
cm_node);
pci_free_consistent(nesdev->pcidev,
nesqp->private_data_len + nesqp->ietf_frame_size,
nesqp->ietf_frame, nesqp->ietf_frame_pbase);
- return -ENOMEM;
+ return PTR_ERR(ibmr);
}
ibmr->pd = &nespd->ibpd;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] RDMA/nes: checking for NULL instead of IS_ERR
2016-01-12 9:27 [patch] RDMA/nes: checking for NULL instead of IS_ERR Dan Carpenter
@ 2016-01-12 15:12 ` Christoph Hellwig
2016-01-19 20:59 ` Doug Ledford
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2016-01-12 15:12 UTC (permalink / raw)
To: Dan Carpenter
Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
Christoph Hellwig, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
On Tue, Jan 12, 2016 at 12:27:43PM +0300, Dan Carpenter wrote:
> nes_reg_phys_mr() returns ERR_PTRs on error. It doesn't return NULL.
>
> This bug has been there for a while, but we recently changed from
> calling a function pointer to calling nes_reg_phys_mr() directly so now
> Smatch is able to detect the bug.
Looks fine,
Reviewed-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
--
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] 3+ messages in thread
* Re: [patch] RDMA/nes: checking for NULL instead of IS_ERR
2016-01-12 15:12 ` Christoph Hellwig
@ 2016-01-19 20:59 ` Doug Ledford
0 siblings, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2016-01-19 20:59 UTC (permalink / raw)
To: Christoph Hellwig, Dan Carpenter
Cc: Faisal Latif, Sean Hefty, Hal Rosenstock, linux-rdma,
kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 554 bytes --]
On 01/12/2016 10:12 AM, Christoph Hellwig wrote:
> On Tue, Jan 12, 2016 at 12:27:43PM +0300, Dan Carpenter wrote:
>> nes_reg_phys_mr() returns ERR_PTRs on error. It doesn't return NULL.
>>
>> This bug has been there for a while, but we recently changed from
>> calling a function pointer to calling nes_reg_phys_mr() directly so now
>> Smatch is able to detect the bug.
>
> Looks fine,
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
Thanks, applied.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-19 20:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-12 9:27 [patch] RDMA/nes: checking for NULL instead of IS_ERR Dan Carpenter
2016-01-12 15:12 ` Christoph Hellwig
2016-01-19 20:59 ` Doug Ledford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).