[PATCH linux dev-4.10 v3 19/31] drivers: fsi: occ: Return ENODEV if client is NULL
Eddie James
eajames at linux.vnet.ibm.com
Fri Oct 6 06:24:12 AEDT 2017
From: "Edward A. James" <eajames at us.ibm.com>
Safeguard the in-kernel api functions.
Signed-off-by: Edward A. James <eajames at us.ibm.com>
---
drivers/fsi/occ.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/fsi/occ.c b/drivers/fsi/occ.c
index 55f293d..a551349 100644
--- a/drivers/fsi/occ.c
+++ b/drivers/fsi/occ.c
@@ -654,18 +654,27 @@ struct occ_client *occ_drv_open(struct device *dev, unsigned long flags)
int occ_drv_read(struct occ_client *client, char *buf, size_t len)
{
+ if (!client)
+ return -ENODEV;
+
return occ_read_common(client, NULL, buf, len);
}
EXPORT_SYMBOL_GPL(occ_drv_read);
int occ_drv_write(struct occ_client *client, const char *buf, size_t len)
{
+ if (!client)
+ return -ENODEV;
+
return occ_write_common(client, NULL, buf, len);
}
EXPORT_SYMBOL_GPL(occ_drv_write);
void occ_drv_release(struct occ_client *client)
{
+ if (!client)
+ return;
+
occ_release_common(client);
}
EXPORT_SYMBOL_GPL(occ_drv_release);
--
1.8.3.1
More information about the openbmc
mailing list