ib_srpt: checking NULL instead of ERR_PTR
Subsystems (3)
PATCH 2/3 ib_srpt: checking NULL instead of ERR_PTR
transport_init_session() and target_fabric_configfs_init() don't return NULL pointers, they only return ERR_PTRs or valid pointers.
drivers/infiniband/ulp/srpt/ib_srpt.c +3 -3
@@ -2602,10 +2602,10 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, } ch->sess =transport_init_session (); -if (!ch->sess) { +if (IS_ERR (ch->sess)) { rej->reason =__constant_cpu_to_be32 (SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES );pr_debug ("Failed to create session\n" ); goto deregister_session; } ch->sess->se_node_acl = &nacl->nacl;
@@ -4019,10 +4020,10 @@ static int __init srpt_init_module(void)spin_lock_init (&srpt_dev_lock);INIT_LIST_HEAD (&srpt_dev_list); - ret = -ENODEV ; srpt_target =target_fabric_configfs_init (THIS_MODULE ,"srpt" ); -if (!srpt_target) { +if (IS_ERR (srpt_target)) {printk (KERN_ERR "couldn't register\n" ); + ret =PTR_ERR (srpt_target); goto out; }
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Dan Carpenter
transport_init_session()andtarget_fabric_configfs_init()don't return NULL pointers, they only returnERR_PTRsor valid pointers.Signed-off-by Dan Carpenter <[email protected]>
Thanks for catching this breakage. It appears that are a few other locations outside of ib_srpt where return checking for these two functions needs to be fixed as well. I'll fix this up shortly.
Thanks for the review!
--nab
Quoted 30 lines
drivers/infiniband/ulp/srpt/ib_srpt.c +3
-3@@ -2602,10 +2602,10 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, } ch->sess =transport_init_session (); -if (!ch->sess) { +if (IS_ERR (ch->sess)) { rej->reason =__constant_cpu_to_be32 (SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES );pr_debug ("Failed to create session\n" ); goto deregister_session; } ch->sess->se_node_acl = &nacl->nacl;@@ -4019,10 +4020,10 @@ static int __init srpt_init_module(void)spin_lock_init (&srpt_dev_lock);INIT_LIST_HEAD (&srpt_dev_list); - ret = -ENODEV ; srpt_target =target_fabric_configfs_init (THIS_MODULE ,"srpt" ); -if (!srpt_target) { +if (IS_ERR (srpt_target)) {printk (KERN_ERR "couldn't register\n" ); + ret =PTR_ERR (srpt_target); goto out; }
Quoted 10 lines · Nicholas A. Bellinger
Quoted 4 lines · Dan Carpenter
transport_init_session()andtarget_fabric_configfs_init()don't return NULL pointers, they only returnERR_PTRsor valid pointers.Signed-off-by Dan Carpenter <[email protected]>Thanks for catching this breakage. It appears that are a few other locations outside of
ib_srptwhere return checking for these two functions needs to be fixed as well. I'll fix this up shortly.
All the others seem to fixed up. It's just these two place which need to be fixed still. My patch still applies fine with a little fuzz. ;)
regards,
dan carpenter
A message that is not in the archive (sent off-list or not yet received): CA+_b7DK-=ORJQ20aHE_aVgEud4vAPQG_sskOeMqftabzun0h+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 2 lines · Dan Carpenter
All the others seem to fixed up. It's just these two place which need to be fixed still. My patch still applies fine with a little fuzz. ;)
I have a few pending srpt patches, coincidentally including one that hits very near yours leading to a trivial conflict. So I just merged yours into your tree as well and I guess I'll send to Linus shortly.
Thanks,
Roland
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html