Linux Kernels

staging: android: ion: dummy: fix dereference of ERR_PTR

This change “staging: android: ion: dummy: fix dereference of ERR_PTR” (commit 9f563f1) in Linux kernel is authored by Sudip Mukherjee <sudipm.mukherjee [at] gmail.com> on Thu Apr 7 22:02:25 2016 +0530.

Description of "staging: android: ion: dummy: fix dereference of ERR_PTR"

The change “staging: android: ion: dummy: fix dereference of ERR_PTR” introduces changes as follows.

staging: android: ion: dummy: fix dereference of ERR_PTR

ion_device_create() can fail and if it fails then it returns the error
value in ERR_PTR.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Reviewed-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Linux kernel releases containing commit 9f563f1

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "staging: android: ion: dummy: fix dereference of ERR_PTR"

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/staging/android/ion/ion_dummy_driver.c | 2 ++
 1 file changed, 2 insertions(+)
 
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c b/drivers/staging/android/ion/ion_dummy_driver.c
index 5678870bff48..814a3c92a56e 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,6 +68,8 @@ static int __init ion_dummy_init(void)
 	int i, err;
 
 	idev = ion_device_create(NULL);
+	if (IS_ERR(idev))
+		return PTR_ERR(idev);
 	heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
 			GFP_KERNEL);
 	if (!heaps)

The commit for this change in Linux stable tree is 9f563f1 (patch).

Last modified: 2020/01/11 10:07