All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drivers: android: Use octal permissions
@ 2017-12-22 14:07 Harsh Shandilya
  2017-12-22 14:07 ` [PATCH 2/2] drivers: android: Fix logtags in methods Harsh Shandilya
  0 siblings, 1 reply; 6+ messages in thread
From: Harsh Shandilya @ 2017-12-22 14:07 UTC (permalink / raw)
  To: devel
  Cc: Harsh Shandilya, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, linux-kernel

From: Harsh Shandilya <harsh@prjkt.io>

checkpatch warns against the use of symbolic permissions,
this patch migrates all symbolic permissions in the binder
driver to octal permissions.

Test: debugfs nodes created by binder have the same unix
permissions prior to and after this patch was applied.

Signed-off-by: Harsh Shandilya <harsh@prjkt.io>

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Todd Kjos <tkjos@android.com>
Cc: Martijn Coenen <maco@android.com>
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org

---
 drivers/android/binder.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index bccec9de0533..ffb31dd9191a 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -141,7 +141,7 @@ enum {
 };
 static uint32_t binder_debug_mask = BINDER_DEBUG_USER_ERROR |
 	BINDER_DEBUG_FAILED_TRANSACTION | BINDER_DEBUG_DEAD_TRANSACTION;
-module_param_named(debug_mask, binder_debug_mask, uint, S_IWUSR | S_IRUGO);
+module_param_named(debug_mask, binder_debug_mask, uint, 0644);
 
 static char *binder_devices_param = CONFIG_ANDROID_BINDER_DEVICES;
 module_param_named(devices, binder_devices_param, charp, 0444);
@@ -160,7 +160,7 @@ static int binder_set_stop_on_user_error(const char *val,
 	return ret;
 }
 module_param_call(stop_on_user_error, binder_set_stop_on_user_error,
-	param_get_int, &binder_stop_on_user_error, S_IWUSR | S_IRUGO);
+	param_get_int, &binder_stop_on_user_error, 0644);
 
 #define binder_debug(mask, x...) \
 	do { \
@@ -4679,7 +4679,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
 		 * anyway print all contexts that a given PID has, so this
 		 * is not a problem.
 		 */
-		proc->debugfs_entry = debugfs_create_file(strbuf, S_IRUGO,
+		proc->debugfs_entry = debugfs_create_file(strbuf, 0444,
 			binder_debugfs_dir_entry_proc,
 			(void *)(unsigned long)proc->pid,
 			&binder_proc_fops);
@@ -5518,27 +5518,27 @@ static int __init binder_init(void)
 
 	if (binder_debugfs_dir_entry_root) {
 		debugfs_create_file("state",
-				    S_IRUGO,
+				    0444,
 				    binder_debugfs_dir_entry_root,
 				    NULL,
 				    &binder_state_fops);
 		debugfs_create_file("stats",
-				    S_IRUGO,
+				    0444,
 				    binder_debugfs_dir_entry_root,
 				    NULL,
 				    &binder_stats_fops);
 		debugfs_create_file("transactions",
-				    S_IRUGO,
+				    0444,
 				    binder_debugfs_dir_entry_root,
 				    NULL,
 				    &binder_transactions_fops);
 		debugfs_create_file("transaction_log",
-				    S_IRUGO,
+				    0444,
 				    binder_debugfs_dir_entry_root,
 				    &binder_transaction_log,
 				    &binder_transaction_log_fops);
 		debugfs_create_file("failed_transaction_log",
-				    S_IRUGO,
+				    0444,
 				    binder_debugfs_dir_entry_root,
 				    &binder_transaction_log_failed,
 				    &binder_transaction_log_fops);
-- 
2.15.0.631.g7ddcec0

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

* [PATCH 2/2] drivers: android: Fix logtags in methods
  2017-12-22 14:07 [PATCH 1/2] drivers: android: Use octal permissions Harsh Shandilya
@ 2017-12-22 14:07 ` Harsh Shandilya
  2018-01-09 17:02   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Harsh Shandilya @ 2017-12-22 14:07 UTC (permalink / raw)
  To: devel
  Cc: Harsh Shandilya, Greg Kroah-Hartman, Arve Hjønnevåg,
	Todd Kjos, Martijn Coenen, linux-kernel

From: Harsh Shandilya <harsh@prjkt.io>

Several methods in the driver were hardcoding
the function name in their logging calls which
is a checkpatch violation. Utilise the __func__
macro to avoid needing to add the function name
as is to the string.

Test: logtags in dmesg remain unaffected before
and after the patch.

Signed-off-by: Harsh Shandilya <harsh@prjkt.io>

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Arve Hjønnevåg" <arve@android.com>
Cc: Todd Kjos <tkjos@android.com>
Cc: Martijn Coenen <maco@android.com>
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/android/binder.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index ffb31dd9191a..1e48acfe27b7 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -4467,8 +4467,8 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	unsigned int size = _IOC_SIZE(cmd);
 	void __user *ubuf = (void __user *)arg;
 
-	/*pr_info("binder_ioctl: %d:%d %x %lx\n",
-			proc->pid, current->pid, cmd, arg);*/
+	// pr_info("%s: %d:%d %x %lx\n",
+	//		__func__, proc->pid, current->pid, cmd, arg);
 
 	binder_selftest_alloc(&proc->alloc);
 
@@ -4631,8 +4631,9 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma)
 	return 0;
 
 err_bad_arg:
-	pr_err("binder_mmap: %d %lx-%lx %s failed %d\n",
-	       proc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
+	pr_err("%s: %d %lx-%lx %s failed %d\n",
+		__func__, proc->pid, vma->vm_start, vma->vm_end,
+		failure_string, ret);
 	return ret;
 }
 
@@ -4641,8 +4642,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
 	struct binder_proc *proc;
 	struct binder_device *binder_dev;
 
-	binder_debug(BINDER_DEBUG_OPEN_CLOSE, "binder_open: %d:%d\n",
-		     current->group_leader->pid, current->pid);
+	binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n",
+			__func__, current->group_leader->pid, current->pid);
 
 	proc = kzalloc(sizeof(*proc), GFP_KERNEL);
 	if (proc == NULL)
-- 
2.15.0.631.g7ddcec0

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

* Re: [PATCH 2/2] drivers: android: Fix logtags in methods
  2017-12-22 14:07 ` [PATCH 2/2] drivers: android: Fix logtags in methods Harsh Shandilya
@ 2018-01-09 17:02   ` Greg Kroah-Hartman
  2018-01-09 19:45     ` Harsh Shandilya
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-09 17:02 UTC (permalink / raw)
  To: Harsh Shandilya
  Cc: devel, Todd Kjos, linux-kernel, Arve Hjønnevåg,
	Harsh Shandilya, Martijn Coenen

On Fri, Dec 22, 2017 at 07:37:03PM +0530, Harsh Shandilya wrote:
> From: Harsh Shandilya <harsh@prjkt.io>
> 
> Several methods in the driver were hardcoding
> the function name in their logging calls which
> is a checkpatch violation. Utilise the __func__
> macro to avoid needing to add the function name
> as is to the string.
> 
> Test: logtags in dmesg remain unaffected before
> and after the patch.
> 
> Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Arve Hjønnevåg" <arve@android.com>
> Cc: Todd Kjos <tkjos@android.com>
> Cc: Martijn Coenen <maco@android.com>
> Cc: devel@driverdev.osuosl.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/android/binder.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Patch does not apply to my tree :(

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

* Re: [PATCH 2/2] drivers: android: Fix logtags in methods
  2018-01-09 17:02   ` Greg Kroah-Hartman
@ 2018-01-09 19:45     ` Harsh Shandilya
  2018-01-09 20:03       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Harsh Shandilya @ 2018-01-09 19:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arve Hjønnevåg, Harsh Shandilya, Martijn Coenen,
	Todd Kjos, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

On Tue 9 Jan, 2018, 10:32 PM Greg Kroah-Hartman, <gregkh@linuxfoundation.org>
wrote:

> On Fri, Dec 22, 2017 at 07:37:03PM +0530, Harsh Shandilya wrote:
> > From: Harsh Shandilya <harsh@prjkt.io>
> >
> > Several methods in the driver were hardcoding
> > the function name in their logging calls which
> > is a checkpatch violation. Utilise the __func__
> > macro to avoid needing to add the function name
> > as is to the string.
> >
> > Test: logtags in dmesg remain unaffected before
> > and after the patch.
> >
> > Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
> >
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: "Arve Hjønnevåg" <arve@android.com>
> > Cc: Todd Kjos <tkjos@android.com>
> > Cc: Martijn Coenen <maco@android.com>
> > Cc: devel@driverdev.osuosl.org
> > Cc: linux-kernel@vger.kernel.org
> > ---
> >  drivers/android/binder.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
>
> Patch does not apply to my tree :(
>

If you drop
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?h=char-misc-next&id=00c41cddebde8d1a635bf81a7b255b7e56fd0d15
then the patch should go in cleanly. My patch includes the changes from
Elad's already.

P.S. sorry about the derp with the email earlier, I didn't realise I used
"Reply" in place of "Reply all". Will take care henceforth.

>

[-- Attachment #2: Type: text/html, Size: 2618 bytes --]

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

* Re: [PATCH 2/2] drivers: android: Fix logtags in methods
  2018-01-09 19:45     ` Harsh Shandilya
@ 2018-01-09 20:03       ` Greg Kroah-Hartman
  2018-01-09 20:07         ` Harsh Shandilya
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-09 20:03 UTC (permalink / raw)
  To: Harsh Shandilya
  Cc: Arve Hjønnevåg, Harsh Shandilya, Martijn Coenen,
	Todd Kjos, devel, linux-kernel

On Tue, Jan 09, 2018 at 07:45:33PM +0000, Harsh Shandilya wrote:
> On Tue 9 Jan, 2018, 10:32 PM Greg Kroah-Hartman, <gregkh@linuxfoundation.org>
> wrote:
> 
> > On Fri, Dec 22, 2017 at 07:37:03PM +0530, Harsh Shandilya wrote:
> > > From: Harsh Shandilya <harsh@prjkt.io>
> > >
> > > Several methods in the driver were hardcoding
> > > the function name in their logging calls which
> > > is a checkpatch violation. Utilise the __func__
> > > macro to avoid needing to add the function name
> > > as is to the string.
> > >
> > > Test: logtags in dmesg remain unaffected before
> > > and after the patch.
> > >
> > > Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
> > >
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: "Arve Hjønnevåg" <arve@android.com>
> > > Cc: Todd Kjos <tkjos@android.com>
> > > Cc: Martijn Coenen <maco@android.com>
> > > Cc: devel@driverdev.osuosl.org
> > > Cc: linux-kernel@vger.kernel.org
> > > ---
> > >  drivers/android/binder.c | 13 +++++++------
> > >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > Patch does not apply to my tree :(
> >
> 
> If you drop
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?h=char-misc-next&id=00c41cddebde8d1a635bf81a7b255b7e56fd0d15
> then the patch should go in cleanly. My patch includes the changes from
> Elad's already.

That patch came first in my inbox, I'm not going to revert it from the
tree now, sorry.

Just rebase and resend if your patch did "more".

thanks,

greg k-h

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

* Re: [PATCH 2/2] drivers: android: Fix logtags in methods
  2018-01-09 20:03       ` Greg Kroah-Hartman
@ 2018-01-09 20:07         ` Harsh Shandilya
  0 siblings, 0 replies; 6+ messages in thread
From: Harsh Shandilya @ 2018-01-09 20:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arve Hjønnevåg, Harsh Shandilya, Martijn Coenen,
	Todd Kjos, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]

On Wed 10 Jan, 2018, 1:33 AM Greg Kroah-Hartman, <gregkh@linuxfoundation.org>
wrote:

> On Tue, Jan 09, 2018 at 07:45:33PM +0000, Harsh Shandilya wrote:
> > On Tue 9 Jan, 2018, 10:32 PM Greg Kroah-Hartman, <
> gregkh@linuxfoundation.org>
> > wrote:
> >
> > > On Fri, Dec 22, 2017 at 07:37:03PM +0530, Harsh Shandilya wrote:
> > > > From: Harsh Shandilya <harsh@prjkt.io>
> > > >
> > > > Several methods in the driver were hardcoding
> > > > the function name in their logging calls which
> > > > is a checkpatch violation. Utilise the __func__
> > > > macro to avoid needing to add the function name
> > > > as is to the string.
> > > >
> > > > Test: logtags in dmesg remain unaffected before
> > > > and after the patch.
> > > >
> > > > Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
> > > >
> > > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > Cc: "Arve Hjønnevåg" <arve@android.com>
> > > > Cc: Todd Kjos <tkjos@android.com>
> > > > Cc: Martijn Coenen <maco@android.com>
> > > > Cc: devel@driverdev.osuosl.org
> > > > Cc: linux-kernel@vger.kernel.org
> > > > ---
> > > >  drivers/android/binder.c | 13 +++++++------
> > > >  1 file changed, 7 insertions(+), 6 deletions(-)
> > >
> > > Patch does not apply to my tree :(
> > >
> >
> > If you drop
> >
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?h=char-misc-next&id=00c41cddebde8d1a635bf81a7b255b7e56fd0d15
> > then the patch should go in cleanly. My patch includes the changes from
> > Elad's already.
>
> That patch came first in my inbox, I'm not going to revert it from the
> tree now, sorry.
>
> Just rebase and resend if your patch did "more".
>
> thanks,
>
> greg k-h
>

Comparing both patches again I think Elad's is the better one to keep since
the only difference between his and mine is that I also fixed up a
commented out pr_info call. You can ignore my patch, sorry for the noise.

>

[-- Attachment #2: Type: text/html, Size: 3471 bytes --]

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

end of thread, other threads:[~2018-01-09 20:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-22 14:07 [PATCH 1/2] drivers: android: Use octal permissions Harsh Shandilya
2017-12-22 14:07 ` [PATCH 2/2] drivers: android: Fix logtags in methods Harsh Shandilya
2018-01-09 17:02   ` Greg Kroah-Hartman
2018-01-09 19:45     ` Harsh Shandilya
2018-01-09 20:03       ` Greg Kroah-Hartman
2018-01-09 20:07         ` Harsh Shandilya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.