linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: android: ion: Avoid NULL point in error path
@ 2018-02-01 12:34 Yisheng Xie
  2018-02-01 12:34 ` [PATCH 2/2] staging: android: ion: Remove lable debugfs_done Yisheng Xie
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yisheng Xie @ 2018-02-01 12:34 UTC (permalink / raw)
  To: gregkh; +Cc: devel, Yisheng Xie, sumit.semwal, linux-kernel

If we failed to create debugfs for ion at ion_device_create, the
debug_root of ion_device will be NULL, and then when try to create debug
file for shrinker of heap it will be create on the top of debugfs. If we
also failed to create this the debug file, it call dentry_path to found
the path of debug_root, then a NULL point will occur.

Fix this by avoiding call dentry_path, but show the debug name only when
failed to create debug file for shrinker.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
 drivers/staging/android/ion/ion.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index f480885..3e41644 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -570,13 +570,9 @@ void ion_device_add_heap(struct ion_heap *heap)
 		debug_file = debugfs_create_file(
 			debug_name, 0644, dev->debug_root, heap,
 			&debug_shrink_fops);
-		if (!debug_file) {
-			char buf[256], *path;
-
-			path = dentry_path(dev->debug_root, buf, 256);
-			pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
-			       path, debug_name);
-		}
+		if (!debug_file)
+			pr_err("Failed to create ion heap shrinker debugfs at %s\n",
+			       debug_name);
 	}
 
 	dev->heap_cnt++;
-- 
1.7.12.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 2/2] staging: android: ion: Remove lable debugfs_done
  2018-02-01 12:34 [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Yisheng Xie
@ 2018-02-01 12:34 ` Yisheng Xie
  2018-02-06 23:00   ` Laura Abbott
  2018-02-06 22:59 ` [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Laura Abbott
  2018-02-12 11:40 ` Yisheng Xie
  2 siblings, 1 reply; 5+ messages in thread
From: Yisheng Xie @ 2018-02-01 12:34 UTC (permalink / raw)
  To: gregkh; +Cc: devel, Yisheng Xie, sumit.semwal, linux-kernel

When failed to create debug_root, we will go on initail other part of
ion, so we can just info this message to user and do not need a lable
to jump.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
---
 drivers/staging/android/ion/ion.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 3e41644..70a70f5 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -601,12 +601,9 @@ static int ion_device_create(void)
 	}
 
 	idev->debug_root = debugfs_create_dir("ion", NULL);
-	if (!idev->debug_root) {
+	if (!idev->debug_root)
 		pr_err("ion: failed to create debugfs root directory.\n");
-		goto debugfs_done;
-	}
 
-debugfs_done:
 	idev->buffers = RB_ROOT;
 	mutex_init(&idev->buffer_lock);
 	init_rwsem(&idev->lock);
-- 
1.7.12.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/2] staging: android: ion: Avoid NULL point in error path
  2018-02-01 12:34 [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Yisheng Xie
  2018-02-01 12:34 ` [PATCH 2/2] staging: android: ion: Remove lable debugfs_done Yisheng Xie
@ 2018-02-06 22:59 ` Laura Abbott
  2018-02-12 11:40 ` Yisheng Xie
  2 siblings, 0 replies; 5+ messages in thread
From: Laura Abbott @ 2018-02-06 22:59 UTC (permalink / raw)
  To: Yisheng Xie, gregkh; +Cc: sumit.semwal, devel, linux-kernel

On 02/01/2018 04:34 AM, Yisheng Xie wrote:
> If we failed to create debugfs for ion at ion_device_create, the
> debug_root of ion_device will be NULL, and then when try to create debug
> file for shrinker of heap it will be create on the top of debugfs. If we
> also failed to create this the debug file, it call dentry_path to found
> the path of debug_root, then a NULL point will occur.
> 
> Fix this by avoiding call dentry_path, but show the debug name only when
> failed to create debug file for shrinker.
> 

Acked-by: Laura Abbott <labbott@redhat.com>

> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
>   drivers/staging/android/ion/ion.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index f480885..3e41644 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -570,13 +570,9 @@ void ion_device_add_heap(struct ion_heap *heap)
>   		debug_file = debugfs_create_file(
>   			debug_name, 0644, dev->debug_root, heap,
>   			&debug_shrink_fops);
> -		if (!debug_file) {
> -			char buf[256], *path;
> -
> -			path = dentry_path(dev->debug_root, buf, 256);
> -			pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
> -			       path, debug_name);
> -		}
> +		if (!debug_file)
> +			pr_err("Failed to create ion heap shrinker debugfs at %s\n",
> +			       debug_name);
>   	}
>   
>   	dev->heap_cnt++;
> 

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

* Re: [PATCH 2/2] staging: android: ion: Remove lable debugfs_done
  2018-02-01 12:34 ` [PATCH 2/2] staging: android: ion: Remove lable debugfs_done Yisheng Xie
@ 2018-02-06 23:00   ` Laura Abbott
  0 siblings, 0 replies; 5+ messages in thread
From: Laura Abbott @ 2018-02-06 23:00 UTC (permalink / raw)
  To: Yisheng Xie, gregkh; +Cc: devel, sumit.semwal, linux-kernel

On 02/01/2018 04:34 AM, Yisheng Xie wrote:
> When failed to create debug_root, we will go on initail other part of
> ion, so we can just info this message to user and do not need a lable
> to jump.
> 

Acked-by: Laura Abbott <labbott@redhat.com>

> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
>   drivers/staging/android/ion/ion.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 3e41644..70a70f5 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -601,12 +601,9 @@ static int ion_device_create(void)
>   	}
>   
>   	idev->debug_root = debugfs_create_dir("ion", NULL);
> -	if (!idev->debug_root) {
> +	if (!idev->debug_root)
>   		pr_err("ion: failed to create debugfs root directory.\n");
> -		goto debugfs_done;
> -	}
>   
> -debugfs_done:
>   	idev->buffers = RB_ROOT;
>   	mutex_init(&idev->buffer_lock);
>   	init_rwsem(&idev->lock);
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/2] staging: android: ion: Avoid NULL point in error path
  2018-02-01 12:34 [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Yisheng Xie
  2018-02-01 12:34 ` [PATCH 2/2] staging: android: ion: Remove lable debugfs_done Yisheng Xie
  2018-02-06 22:59 ` [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Laura Abbott
@ 2018-02-12 11:40 ` Yisheng Xie
  2 siblings, 0 replies; 5+ messages in thread
From: Yisheng Xie @ 2018-02-12 11:40 UTC (permalink / raw)
  To: gregkh; +Cc: devel, sumit.semwal, linux-kernel

Hi Greg,

JFYI, I have rebase this patchset to v4.15-rc1.[1]

[1] https://lkml.org/lkml/2018/2/12/204

Thanks
Yisheng

On 2018/2/1 20:34, Yisheng Xie wrote:
> If we failed to create debugfs for ion at ion_device_create, the
> debug_root of ion_device will be NULL, and then when try to create debug
> file for shrinker of heap it will be create on the top of debugfs. If we
> also failed to create this the debug file, it call dentry_path to found
> the path of debug_root, then a NULL point will occur.
> 
> Fix this by avoiding call dentry_path, but show the debug name only when
> failed to create debug file for shrinker.
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
> ---
>  drivers/staging/android/ion/ion.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index f480885..3e41644 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -570,13 +570,9 @@ void ion_device_add_heap(struct ion_heap *heap)
>  		debug_file = debugfs_create_file(
>  			debug_name, 0644, dev->debug_root, heap,
>  			&debug_shrink_fops);
> -		if (!debug_file) {
> -			char buf[256], *path;
> -
> -			path = dentry_path(dev->debug_root, buf, 256);
> -			pr_err("Failed to create heap shrinker debugfs at %s/%s\n",
> -			       path, debug_name);
> -		}
> +		if (!debug_file)
> +			pr_err("Failed to create ion heap shrinker debugfs at %s\n",
> +			       debug_name);
>  	}
>  
>  	dev->heap_cnt++;
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2018-02-12 11:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 12:34 [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Yisheng Xie
2018-02-01 12:34 ` [PATCH 2/2] staging: android: ion: Remove lable debugfs_done Yisheng Xie
2018-02-06 23:00   ` Laura Abbott
2018-02-06 22:59 ` [PATCH 1/2] staging: android: ion: Avoid NULL point in error path Laura Abbott
2018-02-12 11:40 ` Yisheng Xie

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