linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: check return value of idr_find
@ 2019-03-09  4:02 Kangjie Lu
  2019-03-23  2:18 ` Kangjie Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kangjie Lu @ 2019-03-09  4:02 UTC (permalink / raw)
  To: kjlu; +Cc: Sudeep Holla, linux-kernel, linux-arm-kernel, pakki001

idr_find may return NULL, so check its return value and return an
error code.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/firmware/arm_scmi/driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 8f952f2f1a29..35faa203d549 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -709,6 +709,8 @@ scmi_mbox_chan_setup(struct scmi_info *info, struct device *dev, int prot_id)
 
 	if (scmi_mailbox_check(np)) {
 		cinfo = idr_find(&info->tx_idr, SCMI_PROTOCOL_BASE);
+		if (!cinfo)
+			return -EINVAL;
 		goto idr_alloc;
 	}
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-10 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  4:02 [PATCH] firmware: arm_scmi: check return value of idr_find Kangjie Lu
2019-03-23  2:18 ` Kangjie Lu
2019-03-25 11:54 ` Steven Price
2019-03-25 20:48   ` Kangjie Lu
2019-03-26 11:34     ` Steven Price
2019-04-10 16:31     ` Sudeep Holla
2019-04-10 16:25 ` Sudeep Holla

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).