Skip to contentSkip to conversation

PCC: fix dereference of ERR_PTR

PATCH In review Sudip Mukherjee 1 participant 2 messages Sep 16, 2015 – Oct 8, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCC: fix dereference of ERR_PTR

get_pcc_channel() does not return NULL on error it returns the error code in ERR_PTR, but we have been checking it for NULL.

---
 drivers/mailbox/pcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/pcc.c +1 -1
index 68885a8..45d85ae 100644
@@ -122,7 +122,7 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 	 */
 	chan = get_pcc_channel(subspace_id);
 
-	if (!chan || chan->cl) {
+	if (IS_ERR(chan) || chan->cl) {
 		dev_err(dev, "Channel not found for idx: %d\n", subspace_id);
 		return ERR_PTR(-EBUSY);
 	}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · Sudip Mukherjee

get_pcc_channel() does not return NULL on error it returns the error code in ERR_PTR, but we have been checking it for NULL.

---

A gentle ping.

regards
sudip

Quoted 19 lines
 drivers/mailbox/pcc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/pcc.c +1 -1
index 68885a8..45d85ae 100644
@@ -122,7 +122,7 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
 	 */
 	chan = get_pcc_channel(subspace_id);
 
-	if (!chan || chan->cl) {
+	if (IS_ERR(chan) || chan->cl) {
 		dev_err(dev, "Channel not found for idx: %d\n", subspace_id);
 		return ERR_PTR(-EBUSY);
 	}
Signature · 1 line
1.9.1