[PATCH 4/4] Staging: most: fix passing a potential null pointer

Christian Gromm christian.gromm at microchip.com
Tue Jul 28 15:16:11 UTC 2015


This patch fixes passing of a potential null pointer.

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Christian Gromm <christian.gromm at microchip.com>
---
 drivers/staging/most/aim-cdev/cdev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index cfc32df..252a17c 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -204,7 +204,8 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 	}
 	return actual_len - retval;
 error:
-	most_put_mbo(mbo);
+	if (mbo)
+		most_put_mbo(mbo);
 	return err;
 }
 
-- 
1.7.9.5



More information about the devel mailing list