linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel:signal.c Fix coding style errors and warnings.
@ 2014-11-14 15:56 Ionut Alexa
  2014-11-16  2:47 ` Al Viro
  0 siblings, 1 reply; 21+ messages in thread
From: Ionut Alexa @ 2014-11-14 15:56 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Ionut Alexa

    Fix various coding style errors and warnings as:
        - space before tabs
        - exiting a function from different points (else after return
          ..)

Signed-off-by: Ionut Alexa <ionut.m.alexa@gmail.com>
---
 kernel/signal.c |  104 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 55 insertions(+), 49 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f..226b41a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -109,25 +109,28 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
 	switch (_NSIG_WORDS) {
 	default:
 		for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
-			ready |= signal->sig[i] &~ blocked->sig[i];
+			ready |= signal->sig[i] & ~blocked->sig[i];
 		break;
 
-	case 4: ready  = signal->sig[3] &~ blocked->sig[3];
-		ready |= signal->sig[2] &~ blocked->sig[2];
-		ready |= signal->sig[1] &~ blocked->sig[1];
-		ready |= signal->sig[0] &~ blocked->sig[0];
+	case 4:
+		ready  = signal->sig[3] & ~blocked->sig[3];
+		ready |= signal->sig[2] & ~blocked->sig[2];
+		ready |= signal->sig[1] & ~blocked->sig[1];
+		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 2: ready  = signal->sig[1] &~ blocked->sig[1];
-		ready |= signal->sig[0] &~ blocked->sig[0];
+	case 2:
+		ready  = signal->sig[1] & ~blocked->sig[1];
+		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 1: ready  = signal->sig[0] &~ blocked->sig[0];
+	case 1:
+		ready  = signal->sig[0] & ~blocked->sig[0];
 	}
 	return ready !=	0;
 }
 
-#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
+#define PENDING(p, b) has_pending_signals(&(p)->signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -180,7 +183,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 	 * Handle the first word specially: it contains the
 	 * synchronous signals that need to be dequeued first.
 	 */
-	x = *s &~ *m;
+	x = *s & ~*m;
 	if (x) {
 		if (x & SYNCHRONOUS_MASK)
 			x &= SYNCHRONOUS_MASK;
@@ -191,7 +194,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 	switch (_NSIG_WORDS) {
 	default:
 		for (i = 1; i < _NSIG_WORDS; ++i) {
-			x = *++s &~ *++m;
+			x = *++s & ~*++m;
 			if (!x)
 				continue;
 			sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +203,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 		break;
 
 	case 2:
-		x = s[1] &~ m[1];
+		x = s[1] & ~m[1];
 		if (!x)
 			break;
 		sig = ffz(~x) + _NSIG_BPW + 1;
@@ -224,8 +227,8 @@ static inline void print_dropped_signal(int sig)
 	if (!__ratelimit(&ratelimit_state))
 		return;
 
-	printk(KERN_INFO "%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
-				current->comm, current->pid, sig);
+	pr_info("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
+					current->comm, current->pid, sig);
 }
 
 /**
@@ -936,7 +939,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 		 * There is just one thread and it does not need to be woken.
 		 * It will dequeue unblocked signals before it runs again.
 		 */
-		return;
+		goto exit_func;
 	else {
 		/*
 		 * Otherwise try to find a suitable thread.
@@ -950,7 +953,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 				 * Any eligible threads will see
 				 * the signal in the queue soon.
 				 */
-				return;
+				goto exit_func;
 		}
 		signal->curr_target = t;
 	}
@@ -982,7 +985,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 				sigaddset(&t->pending.signal, SIGKILL);
 				signal_wake_up(t, 1);
 			} while_each_thread(p, t);
-			return;
+			goto exit_func;
 		}
 	}
 
@@ -991,6 +994,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 	 * Tell the chosen thread to wake up and dequeue it.
 	 */
 	signal_wake_up(t, sig == SIGKILL);
+exit_func:
 	return;
 }
 
@@ -1140,10 +1144,10 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 static void print_fatal_signal(int signr)
 {
 	struct pt_regs *regs = signal_pt_regs();
-	printk(KERN_INFO "potentially unexpected fatal signal %d.\n", signr);
+	pr_info("potentially unexpected fatal signal %d.\n", signr);
 
 #if defined(__i386__) && !defined(__arch_um__)
-	printk(KERN_INFO "code at %08lx: ", regs->ip);
+	pr_info("code at %08lx: ", regs->ip);
 	{
 		int i;
 		for (i = 0; i < 16; i++) {
@@ -1151,10 +1155,10 @@ static void print_fatal_signal(int signr)
 
 			if (get_user(insn, (unsigned char *)(regs->ip + i)))
 				break;
-			printk(KERN_CONT "%02x ", insn);
+			pr_cont("%02x ", insn);
 		}
 	}
-	printk(KERN_CONT "\n");
+	pr_cont("\n");
 #endif
 	preempt_disable();
 	show_regs(regs);
@@ -1163,7 +1167,7 @@ static void print_fatal_signal(int signr)
 
 static int __init setup_print_fatal_signals(char *str)
 {
-	get_option (&str, &print_fatal_signals);
+	get_option(&str, &print_fatal_signals);
 
 	return 1;
 }
@@ -1431,7 +1435,7 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
 				pid ? find_vpid(-pid) : task_pgrp(current));
 	} else {
 		int retval = 0, count = 0;
-		struct task_struct * p;
+		struct task_struct *p;
 
 		for_each_process(p) {
 			if (task_pid_vnr(p) > 1 &&
@@ -1622,8 +1626,8 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
 
 	BUG_ON(sig == -1);
 
- 	/* do_notify_parent_cldstop should have been called instead.  */
- 	BUG_ON(task_is_stopped_or_traced(tsk));
+	/* do_notify_parent_cldstop should have been called instead.  */
+	BUG_ON(task_is_stopped_or_traced(tsk));
 
 	BUG_ON(!tsk->ptrace &&
 	       (tsk->group_leader != tsk || !thread_group_empty(tsk)));
@@ -1745,20 +1749,20 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
 	info.si_utime = cputime_to_clock_t(utime);
 	info.si_stime = cputime_to_clock_t(stime);
 
- 	info.si_code = why;
- 	switch (why) {
- 	case CLD_CONTINUED:
- 		info.si_status = SIGCONT;
- 		break;
- 	case CLD_STOPPED:
- 		info.si_status = tsk->signal->group_exit_code & 0x7f;
- 		break;
- 	case CLD_TRAPPED:
- 		info.si_status = tsk->exit_code & 0x7f;
- 		break;
- 	default:
- 		BUG();
- 	}
+	info.si_code = why;
+	switch (why) {
+	case CLD_CONTINUED:
+		info.si_status = SIGCONT;
+		break;
+	case CLD_STOPPED:
+		info.si_status = tsk->signal->group_exit_code & 0x7f;
+		break;
+	case CLD_TRAPPED:
+		info.si_status = tsk->exit_code & 0x7f;
+		break;
+	default:
+		BUG();
+	}
 
 	sighand = parent->sighand;
 	spin_lock_irqsave(&sighand->siglock, flags);
@@ -1943,7 +1947,7 @@ static void ptrace_do_notify(int signr, int exit_code, int why)
 {
 	siginfo_t info;
 
-	memset(&info, 0, sizeof info);
+	memset(&info, 0, sizeof(info));
 	info.si_signo = signr;
 	info.si_code = exit_code;
 	info.si_pid = task_pid_vnr(current);
@@ -2357,7 +2361,7 @@ relock:
 }
 
 /**
- * signal_delivered - 
+ * signal_delivered -
  * @ksig:		kernel signal struct
  * @stepping:		nonzero if debugger single-step or block-step in use
  *
@@ -2704,7 +2708,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 {
 	int err;
 
-	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
+	if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
 		return -EFAULT;
 	if (from->si_code < 0)
 		return __copy_to_user(to, from, sizeof(siginfo_t))
@@ -3131,7 +3135,8 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
 }
 
 static int
-do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)
+do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+						unsigned long sp)
 {
 	stack_t oss;
 	int error;
@@ -3195,7 +3200,8 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 out:
 	return error;
 }
-SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss)
+SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
+					stack_t __user *, uoss)
 {
 	return do_sigaltstack(uss, uoss, current_user_stack_pointer());
 }
@@ -3274,7 +3280,7 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
  */
 SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
 {
-	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t)); 
+	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t));
 }
 
 #endif
@@ -3399,7 +3405,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
 	if (!ret && oact) {
 		sigset_to_compat(&mask, &old_ka.sa.sa_mask);
-		ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), 
+		ret = put_user(ptr_to_compat(old_ka.sa.sa_handler),
 			       &oact->sa_handler);
 		ret |= copy_to_user(&oact->sa_mask, &mask, sizeof(mask));
 		ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags);
@@ -3416,7 +3422,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 #ifdef CONFIG_OLD_SIGACTION
 SYSCALL_DEFINE3(sigaction, int, sig,
 		const struct old_sigaction __user *, act,
-	        struct old_sigaction __user *, oact)
+		struct old_sigaction __user *, oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -3452,7 +3458,7 @@ SYSCALL_DEFINE3(sigaction, int, sig,
 #ifdef CONFIG_COMPAT_OLD_SIGACTION
 COMPAT_SYSCALL_DEFINE3(sigaction, int, sig,
 		const struct compat_old_sigaction __user *, act,
-	        struct compat_old_sigaction __user *, oact)
+		struct compat_old_sigaction __user *, oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -3575,7 +3581,7 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
 		return -EFAULT;
 	return sigsuspend(&newset);
 }
- 
+
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_size_t, sigsetsize)
 {
-- 
1.7.10.4


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

* Re: [PATCH] kernel:signal.c Fix coding style errors and warnings.
  2014-11-14 15:56 [PATCH] kernel:signal.c Fix coding style errors and warnings Ionut Alexa
@ 2014-11-16  2:47 ` Al Viro
       [not found]   ` <CAKF-a2AYAPy2ENaFVanFCWZ_sXHPy_K_uH6zo5apT-kLLaqONA@mail.gmail.com>
  0 siblings, 1 reply; 21+ messages in thread
From: Al Viro @ 2014-11-16  2:47 UTC (permalink / raw)
  To: Ionut Alexa; +Cc: akpm, linux-kernel

On Fri, Nov 14, 2014 at 05:56:55PM +0200, Ionut Alexa wrote:
>     Fix various coding style errors and warnings as:
>         - space before tabs
>         - exiting a function from different points (else after return
>           ..)

How the hell is that goto any better than plain return?  Because some
moronic script^W^Wholy oracle says so?

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

* Re: [PATCH] kernel:signal.c Fix coding style errors and warnings.
       [not found]   ` <CAKF-a2AYAPy2ENaFVanFCWZ_sXHPy_K_uH6zo5apT-kLLaqONA@mail.gmail.com>
@ 2014-11-16 17:08     ` Al Viro
       [not found]       ` <CAKF-a2AhmE4iZHsRNgyp6Le6uaDNSUjbxQENm5sTYD3f24ORnA@mail.gmail.com>
  0 siblings, 1 reply; 21+ messages in thread
From: Al Viro @ 2014-11-16 17:08 UTC (permalink / raw)
  To: Ionut Alexa; +Cc: akpm, linux-kernel

On Sun, Nov 16, 2014 at 11:41:42AM +0200, Ionut Alexa wrote:
> A good programming practice is to have a single exit point of the function.

It is a very simplified form of something that was a a good practice until
some rather important parts had been dropped.

> Respecting this rule will reduce strage behavior when the memory is altered
> due to magnetic interference or other causes.

Elaborate, please.

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

* Re: [PATCH] kernel:signal.c Fix coding style errors and warnings.
       [not found]       ` <CAKF-a2AhmE4iZHsRNgyp6Le6uaDNSUjbxQENm5sTYD3f24ORnA@mail.gmail.com>
@ 2014-11-16 18:01         ` Al Viro
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
  0 siblings, 1 reply; 21+ messages in thread
From: Al Viro @ 2014-11-16 18:01 UTC (permalink / raw)
  To: Ionut Alexa; +Cc: akpm, linux-kernel

On Sun, Nov 16, 2014 at 07:28:29PM +0200, Ionut Alexa wrote:
> I worked a while in critical automotive software application. There is
> nothing more important than to know your program is running start-to-end in
> the correct order. For the automotive indurstri is safety critical. For PC
> application is not madatory. But for Operating systems, it is a good
> practice. If the function exits from a diferent point depending on some
> conditions, it is hard to debug when the kernel behavior is not the
> expected one.

Excuse me, but this is pure cargo-cult argument.  There is a lot more to
complexity of debugging than blind application of rules like that.  Sure,
the control flow graph affects it.  However, proposed change ("replace
all returns with goto to the end") is not an improvement at all.

There are reasons behind these practices; applying them without understanding
those is not going to work.  And the reasons behind the "single exit point
is better" apply to those goto just as well as they did to those return;
control flow remains the same, after all.

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

* [UNNECESSARY PATCH 00/16] signal: coding style wankery...
  2014-11-16 18:01         ` Al Viro
@ 2014-11-16 20:09           ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 01/16] signal: whitespace neatening Joe Perches
                               ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa; +Cc: Al Viro, Andrew Morton, linux-kernel

This is intended to be instructive for Ionet Alexa.
All these patches are almost totally unnecessary.

Converting a bunch of issues all at the same time makes for very
difficult reviewing.  Separating the changes into individual
patches can make verifying and accepting the changes easier.

If signal.c was changed just neatening purposes, this is how I
think it should be done.

Even if these patches were applied, there would still checkpatch
messages that are and should be ignored because:

o logic there shouldn't be changed
o 80 column warnings don't have to be fixed
o checkpatch is just a brainless little script

ie:

before the patches:
$ ./scripts/checkpatch.pl -f --strict kernel/signal.c
[...]
total: 53 errors, 99 warnings, 37 checks, 3674 lines checked

after:

$ ./scripts/checkpatch.pl -f --strict kernel/signal.c
WARNING: line over 80 characters
#596: FILE: kernel/signal.c:596:
+				if (!current->notifier(current->notifier_data)) {

WARNING: else is not generally useful after a break or return
#948: FILE: kernel/signal.c:948:
+		return;
+	} else {

CHECK: architecture specific defines should be avoided
#1152: FILE: kernel/signal.c:1152:
+#if defined(__i386__) && !defined(__arch_um__)

CHECK: __setup appears un-documented -- check Documentation/kernel-parameters.txt
#1179: FILE: kernel/signal.c:1179:
+__setup("print-fatal-signals=", setup_print_fatal_signals);

WARNING: line over 80 characters
#1452: FILE: kernel/signal.c:1452:
+				       pid ? find_vpid(-pid) : task_pgrp(current));

WARNING: else is not generally useful after a break or return
#2105: FILE: kernel/signal.c:2105:
+		return true;
+	} else {

WARNING: line over 80 characters
#3753: FILE: kernel/signal.c:3753:
+		kdb_printf("Process is not RUNNING, sending a signal from kdb risks deadlock on the run queue locks. The signal has _not_ been sent.\n"

total: 0 errors, 5 warnings, 2 checks, 3764 lines checked

Joe Perches (16):
  signal: whitespace neatening
  signal: vertical line neatening
  signal: Move EXPORT_SYMBOL after function definition
  signal: Use pr_<level>
  signal: Move case statements to separate lines and for loop neatening
  signal: Use consistent function definition style
  signal: Add braces
  signal: Remove unnecessary return
  signal: Use include <linux not <asm
  signal: Remove unnecessary parentheses from function pointer call
  signal: Add parenthese around sizeof argument
  signal: 80 column wrapping
  signal: Move label to first column
  signal: Convert for (;;) to do {} while
  signal: Isolate returns by adding blank lines
  signal: Coalesce kdb_printf formats

 kernel/signal.c | 528 +++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 309 insertions(+), 219 deletions(-)

-- 
2.1.2


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

* [UNNECESSARY PATCH 01/16] signal: whitespace neatening
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 02/16] signal: vertical line neatening Joe Perches
                               ` (14 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

No change in object produced.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 174 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 87 insertions(+), 87 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 19e3513..24aaaee 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -72,7 +72,7 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force)
 	handler = sig_handler(t, sig);
 
 	if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) &&
-			handler == SIG_DFL && !force)
+	    handler == SIG_DFL && !force)
 		return 1;
 
 	return sig_handler_ignored(handler, sig);
@@ -109,25 +109,25 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
 	switch (_NSIG_WORDS) {
 	default:
 		for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
-			ready |= signal->sig[i] &~ blocked->sig[i];
+			ready |= signal->sig[i] & ~blocked->sig[i];
 		break;
 
-	case 4: ready  = signal->sig[3] &~ blocked->sig[3];
-		ready |= signal->sig[2] &~ blocked->sig[2];
-		ready |= signal->sig[1] &~ blocked->sig[1];
-		ready |= signal->sig[0] &~ blocked->sig[0];
+	case 4: ready  = signal->sig[3] & ~blocked->sig[3];
+		ready |= signal->sig[2] & ~blocked->sig[2];
+		ready |= signal->sig[1] & ~blocked->sig[1];
+		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 2: ready  = signal->sig[1] &~ blocked->sig[1];
-		ready |= signal->sig[0] &~ blocked->sig[0];
+	case 2: ready  = signal->sig[1] & ~blocked->sig[1];
+		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 1: ready  = signal->sig[0] &~ blocked->sig[0];
+	case 1: ready  = signal->sig[0] & ~blocked->sig[0];
 	}
 	return ready !=	0;
 }
 
-#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
+#define PENDING(p, b) has_pending_signals(&(p)->signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -164,7 +164,7 @@ void recalc_sigpending(void)
 
 /* Given the mask, find the first available signal that should be serviced. */
 
-#define SYNCHRONOUS_MASK \
+#define SYNCHRONOUS_MASK					\
 	(sigmask(SIGSEGV) | sigmask(SIGBUS) | sigmask(SIGILL) | \
 	 sigmask(SIGTRAP) | sigmask(SIGFPE) | sigmask(SIGSYS))
 
@@ -180,7 +180,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 	 * Handle the first word specially: it contains the
 	 * synchronous signals that need to be dequeued first.
 	 */
-	x = *s &~ *m;
+	x = *s & ~*m;
 	if (x) {
 		if (x & SYNCHRONOUS_MASK)
 			x &= SYNCHRONOUS_MASK;
@@ -191,7 +191,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 	switch (_NSIG_WORDS) {
 	default:
 		for (i = 1; i < _NSIG_WORDS; ++i) {
-			x = *++s &~ *++m;
+			x = *++s & ~*++m;
 			if (!x)
 				continue;
 			sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +200,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 		break;
 
 	case 2:
-		x = s[1] &~ m[1];
+		x = s[1] & ~m[1];
 		if (!x)
 			break;
 		sig = ffz(~x) + _NSIG_BPW + 1;
@@ -225,7 +225,7 @@ static inline void print_dropped_signal(int sig)
 		return;
 
 	printk(KERN_INFO "%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
-				current->comm, current->pid, sig);
+	       current->comm, current->pid, sig);
 }
 
 /**
@@ -374,7 +374,7 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi
 
 	if (override_rlimit ||
 	    atomic_read(&user->sigpending) <=
-			task_rlimit(t, RLIMIT_SIGPENDING)) {
+	    task_rlimit(t, RLIMIT_SIGPENDING)) {
 		q = kmem_cache_alloc(sigqueue_cachep, flags);
 	} else {
 		print_dropped_signal(sig);
@@ -407,7 +407,7 @@ void flush_sigqueue(struct sigpending *queue)
 
 	sigemptyset(&queue->signal);
 	while (!list_empty(&queue->list)) {
-		q = list_entry(queue->list.next, struct sigqueue , list);
+		q = list_entry(queue->list.next, struct sigqueue, list);
 		list_del_init(&q->list);
 		__sigqueue_free(q);
 	}
@@ -550,7 +550,7 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info)
 	/*
 	 * Collect the siginfo appropriate to this signal.  Check if
 	 * there is another siginfo for the same signal.
-	*/
+	 */
 	list_for_each_entry(q, &list->list, list) {
 		if (q->info.si_signo == sig) {
 			if (first)
@@ -562,7 +562,7 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info)
 	sigdelset(&list->signal, sig);
 
 	if (first) {
-still_pending:
+	still_pending:
 		list_del_init(&first->list);
 		copy_siginfo(info, &first->info);
 		__sigqueue_free(first);
@@ -581,7 +581,7 @@ still_pending:
 }
 
 static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
-			siginfo_t *info)
+			    siginfo_t *info)
 {
 	int sig = next_signal(pending, mask);
 
@@ -1021,7 +1021,7 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str
 #endif
 
 static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
-			int group, int from_ancestor_ns)
+			 int group, int from_ancestor_ns)
 {
 	struct sigpending *pending;
 	struct sigqueue *q;
@@ -1032,7 +1032,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 
 	result = TRACE_SIGNAL_IGNORED;
 	if (!prepare_signal(sig, t,
-			from_ancestor_ns || (info == SEND_SIG_FORCED)))
+			    from_ancestor_ns || (info == SEND_SIG_FORCED)))
 		goto ret;
 
 	pending = group ? &t->signal->shared_pending : &t->pending;
@@ -1068,19 +1068,19 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 		override_rlimit = 0;
 
 	q = __sigqueue_alloc(sig, t, GFP_ATOMIC | __GFP_NOTRACK_FALSE_POSITIVE,
-		override_rlimit);
+			     override_rlimit);
 	if (q) {
 		list_add_tail(&q->list, &pending->list);
-		switch ((unsigned long) info) {
-		case (unsigned long) SEND_SIG_NOINFO:
+		switch ((unsigned long)info) {
+		case (unsigned long)SEND_SIG_NOINFO:
 			q->info.si_signo = sig;
 			q->info.si_errno = 0;
 			q->info.si_code = SI_USER;
 			q->info.si_pid = task_tgid_nr_ns(current,
-							task_active_pid_ns(t));
+							 task_active_pid_ns(t));
 			q->info.si_uid = from_kuid_munged(current_user_ns(), current_uid());
 			break;
-		case (unsigned long) SEND_SIG_PRIV:
+		case (unsigned long)SEND_SIG_PRIV:
 			q->info.si_signo = sig;
 			q->info.si_errno = 0;
 			q->info.si_code = SI_KERNEL;
@@ -1125,13 +1125,13 @@ ret:
 }
 
 static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
-			int group)
+		       int group)
 {
 	int from_ancestor_ns = 0;
 
 #ifdef CONFIG_PID_NS
 	from_ancestor_ns = si_fromuser(info) &&
-			   !task_pid_nr_ns(current, task_active_pid_ns(t));
+		!task_pid_nr_ns(current, task_active_pid_ns(t));
 #endif
 
 	return __send_signal(sig, info, t, group, from_ancestor_ns);
@@ -1163,7 +1163,7 @@ static void print_fatal_signal(int signr)
 
 static int __init setup_print_fatal_signals(char *str)
 {
-	get_option (&str, &print_fatal_signals);
+	get_option(&str, &print_fatal_signals);
 
 	return 1;
 }
@@ -1183,7 +1183,7 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
 }
 
 int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p,
-			bool group)
+		     bool group)
 {
 	unsigned long flags;
 	int ret = -ESRCH;
@@ -1379,7 +1379,7 @@ static int kill_as_cred_perm(const struct cred *cred,
 
 /* like kill_pid_info(), but doesn't use uid/euid of "current" */
 int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid,
-			 const struct cred *cred, u32 secid)
+			  const struct cred *cred, u32 secid)
 {
 	int ret = -EINVAL;
 	struct task_struct *p;
@@ -1436,14 +1436,14 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
 	read_lock(&tasklist_lock);
 	if (pid != -1) {
 		ret = __kill_pgrp_info(sig, info,
-				pid ? find_vpid(-pid) : task_pgrp(current));
+				       pid ? find_vpid(-pid) : task_pgrp(current));
 	} else {
 		int retval = 0, count = 0;
-		struct task_struct * p;
+		struct task_struct *p;
 
 		for_each_process(p) {
 			if (task_pid_vnr(p) > 1 &&
-					!same_thread_group(p, current)) {
+			    !same_thread_group(p, current)) {
 				int err = group_send_sig_info(sig, info, p);
 				++count;
 				if (err != -EPERM)
@@ -1473,7 +1473,7 @@ int send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 	return do_send_sig_info(sig, info, p, false);
 }
 
-#define __si_special(priv) \
+#define __si_special(priv)				\
 	((priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO)
 
 int
@@ -1630,8 +1630,8 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
 
 	BUG_ON(sig == -1);
 
- 	/* do_notify_parent_cldstop should have been called instead.  */
- 	BUG_ON(task_is_stopped_or_traced(tsk));
+	/* do_notify_parent_cldstop should have been called instead.  */
+	BUG_ON(task_is_stopped_or_traced(tsk));
 
 	BUG_ON(!tsk->ptrace &&
 	       (tsk->group_leader != tsk || !thread_group_empty(tsk)));
@@ -1753,20 +1753,20 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
 	info.si_utime = cputime_to_clock_t(utime);
 	info.si_stime = cputime_to_clock_t(stime);
 
- 	info.si_code = why;
- 	switch (why) {
- 	case CLD_CONTINUED:
- 		info.si_status = SIGCONT;
- 		break;
- 	case CLD_STOPPED:
- 		info.si_status = tsk->signal->group_exit_code & 0x7f;
- 		break;
- 	case CLD_TRAPPED:
- 		info.si_status = tsk->exit_code & 0x7f;
- 		break;
- 	default:
- 		BUG();
- 	}
+	info.si_code = why;
+	switch (why) {
+	case CLD_CONTINUED:
+		info.si_status = SIGCONT;
+		break;
+	case CLD_STOPPED:
+		info.si_status = tsk->signal->group_exit_code & 0x7f;
+		break;
+	case CLD_TRAPPED:
+		info.si_status = tsk->exit_code & 0x7f;
+		break;
+	default:
+		BUG();
+	}
 
 	sighand = parent->sighand;
 	spin_lock_irqsave(&sighand->siglock, flags);
@@ -2229,7 +2229,7 @@ relock:
 
 		if (ptrace_reparented(current->group_leader))
 			do_notify_parent_cldstop(current->group_leader,
-						true, why);
+						 true, why);
 		read_unlock(&tasklist_lock);
 
 		goto relock;
@@ -2293,7 +2293,7 @@ relock:
 		 * case, the signal cannot be dropped.
 		 */
 		if (unlikely(signal->flags & SIGNAL_UNKILLABLE) &&
-				!sig_kernel_only(signr))
+		    !sig_kernel_only(signr))
 			continue;
 
 		if (sig_kernel_stop(signr)) {
@@ -2365,7 +2365,7 @@ relock:
 }
 
 /**
- * signal_delivered - 
+ * signal_delivered -
  * @ksig:		kernel signal struct
  * @stepping:		nonzero if debugger single-step or block-step in use
  *
@@ -2618,7 +2618,7 @@ SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset,
 
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
-		compat_sigset_t __user *, oset, compat_size_t, sigsetsize)
+		       compat_sigset_t __user *, oset, compat_size_t, sigsetsize)
 {
 #ifdef __BIG_ENDIAN
 	sigset_t old_set = current->blocked;
@@ -2687,7 +2687,7 @@ SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize)
 
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE2(rt_sigpending, compat_sigset_t __user *, uset,
-		compat_size_t, sigsetsize)
+		       compat_size_t, sigsetsize)
 {
 #ifdef __BIG_ENDIAN
 	sigset_t set;
@@ -2712,7 +2712,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 {
 	int err;
 
-	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
+	if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
 		return -EFAULT;
 	if (from->si_code < 0)
 		return __copy_to_user(to, from, sizeof(siginfo_t))
@@ -2735,9 +2735,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 		err |= __put_user(from->si_uid, &to->si_uid);
 		break;
 	case __SI_TIMER:
-		 err |= __put_user(from->si_tid, &to->si_tid);
-		 err |= __put_user(from->si_overrun, &to->si_overrun);
-		 err |= __put_user(from->si_ptr, &to->si_ptr);
+		err |= __put_user(from->si_tid, &to->si_tid);
+		err |= __put_user(from->si_overrun, &to->si_overrun);
+		err |= __put_user(from->si_ptr, &to->si_ptr);
 		break;
 	case __SI_POLL:
 		err |= __put_user(from->si_band, &to->si_band);
@@ -2794,7 +2794,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
  *  @ts: upper bound on process time suspension
  */
 int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
-			const struct timespec *ts)
+		    const struct timespec *ts)
 {
 	struct task_struct *tsk = current;
 	long timeout = MAX_SCHEDULE_TIMEOUT;
@@ -3016,9 +3016,9 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
 
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo,
-			compat_pid_t, pid,
-			int, sig,
-			struct compat_siginfo __user *, uinfo)
+		       compat_pid_t, pid,
+		       int, sig,
+		       struct compat_siginfo __user *, uinfo)
 {
 	siginfo_t info;
 	int ret = copy_siginfo_from_user32(&info, uinfo);
@@ -3061,10 +3061,10 @@ SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig,
 
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo,
-			compat_pid_t, tgid,
-			compat_pid_t, pid,
-			int, sig,
-			struct compat_siginfo __user *, uinfo)
+		       compat_pid_t, tgid,
+		       compat_pid_t, pid,
+		       int, sig,
+		       struct compat_siginfo __user *, uinfo)
 {
 	siginfo_t info;
 
@@ -3139,12 +3139,12 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
 }
 
 static int
-do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)
+do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)
 {
 	stack_t oss;
 	int error;
 
-	oss.ss_sp = (void __user *) current->sas_ss_sp;
+	oss.ss_sp = (void __user *)current->sas_ss_sp;
 	oss.ss_size = current->sas_ss_size;
 	oss.ss_flags = sas_ss_flags(sp);
 
@@ -3169,7 +3169,7 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 		error = -EINVAL;
 		/*
 		 * Note - this code used to test ss_flags incorrectly:
-		 *  	  old code may have been written using ss_flags==0
+		 *	  old code may have been written using ss_flags==0
 		 *	  to mean ss_flags==SS_ONSTACK (as this was the only
 		 *	  way that worked) - this fix preserves that older
 		 *	  mechanism.
@@ -3186,7 +3186,7 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 				goto out;
 		}
 
-		current->sas_ss_sp = (unsigned long) ss_sp;
+		current->sas_ss_sp = (unsigned long)ss_sp;
 		current->sas_ss_size = ss_size;
 	}
 
@@ -3203,7 +3203,7 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 out:
 	return error;
 }
-SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss)
+SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss, stack_t __user *, uoss)
 {
 	return do_sigaltstack(uss, uoss, current_user_stack_pointer());
 }
@@ -3225,8 +3225,8 @@ int __save_altstack(stack_t __user *uss, unsigned long sp)
 
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE2(sigaltstack,
-			const compat_stack_t __user *, uss_ptr,
-			compat_stack_t __user *, uoss_ptr)
+		       const compat_stack_t __user *, uss_ptr,
+		       compat_stack_t __user *, uoss_ptr)
 {
 	stack_t uss, uoss;
 	int ret;
@@ -3244,8 +3244,8 @@ COMPAT_SYSCALL_DEFINE2(sigaltstack,
 	}
 	seg = get_fs();
 	set_fs(KERNEL_DS);
-	ret = do_sigaltstack((stack_t __force __user *) (uss_ptr ? &uss : NULL),
-			     (stack_t __force __user *) &uoss,
+	ret = do_sigaltstack((stack_t __force __user *)(uss_ptr ? &uss : NULL),
+			     (stack_t __force __user *)&uoss,
 			     compat_user_stack_pointer());
 	set_fs(seg);
 	if (ret >= 0 && uoss_ptr)  {
@@ -3282,7 +3282,7 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
  */
 SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
 {
-	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t)); 
+	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t));
 }
 
 #endif
@@ -3374,9 +3374,9 @@ out:
 }
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
-		const struct compat_sigaction __user *, act,
-		struct compat_sigaction __user *, oact,
-		compat_size_t, sigsetsize)
+		       const struct compat_sigaction __user *, act,
+		       struct compat_sigaction __user *, oact,
+		       compat_size_t, sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	compat_sigset_t mask;
@@ -3407,7 +3407,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
 	if (!ret && oact) {
 		sigset_to_compat(&mask, &old_ka.sa.sa_mask);
-		ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), 
+		ret = put_user(ptr_to_compat(old_ka.sa.sa_handler),
 			       &oact->sa_handler);
 		ret |= copy_to_user(&oact->sa_mask, &mask, sizeof(mask));
 		ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags);
@@ -3424,7 +3424,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 #ifdef CONFIG_OLD_SIGACTION
 SYSCALL_DEFINE3(sigaction, int, sig,
 		const struct old_sigaction __user *, act,
-	        struct old_sigaction __user *, oact)
+		struct old_sigaction __user *, oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -3459,8 +3459,8 @@ SYSCALL_DEFINE3(sigaction, int, sig,
 #endif
 #ifdef CONFIG_COMPAT_OLD_SIGACTION
 COMPAT_SYSCALL_DEFINE3(sigaction, int, sig,
-		const struct compat_old_sigaction __user *, act,
-	        struct compat_old_sigaction __user *, oact)
+		       const struct compat_old_sigaction __user *, act,
+		       struct compat_old_sigaction __user *, oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -3583,7 +3583,7 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
 		return -EFAULT;
 	return sigsuspend(&newset);
 }
- 
+
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_size_t, sigsetsize)
 {
-- 
2.1.2


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

* [UNNECESSARY PATCH 02/16] signal: vertical line neatening
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 01/16] signal: whitespace neatening Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 03/16] signal: Move EXPORT_SYMBOL after function definition Joe Perches
                               ` (13 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

No change in object produced.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 24aaaee..abb2bcd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -159,7 +159,6 @@ void recalc_sigpending(void)
 {
 	if (!recalc_sigpending_tsk(current) && !freezing(current))
 		clear_thread_flag(TIF_SIGPENDING);
-
 }
 
 /* Given the mask, find the first available signal that should be serviced. */
@@ -485,6 +484,7 @@ flush_signal_handlers(struct task_struct *t, int force_default)
 {
 	int i;
 	struct k_sigaction *ka = &t->sighand->action[0];
+
 	for (i = _NSIG ; i != 0 ; i--) {
 		if (force_default || ka->sa.sa_handler != SIG_IGN)
 			ka->sa.sa_handler = SIG_DFL;
@@ -500,6 +500,7 @@ flush_signal_handlers(struct task_struct *t, int force_default)
 int unhandled_signal(struct task_struct *tsk, int sig)
 {
 	void __user *handler = tsk->sighand->action[sig-1].sa.sa_handler;
+
 	if (is_global_init(tsk))
 		return 1;
 	if (handler != SIG_IGN && handler != SIG_DFL)
@@ -1140,12 +1141,14 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 static void print_fatal_signal(int signr)
 {
 	struct pt_regs *regs = signal_pt_regs();
+
 	printk(KERN_INFO "potentially unexpected fatal signal %d.\n", signr);
 
 #if defined(__i386__) && !defined(__arch_um__)
 	printk(KERN_INFO "code at %08lx: ", regs->ip);
 	{
 		int i;
+
 		for (i = 0; i < 16; i++) {
 			unsigned char insn;
 
@@ -1330,6 +1333,7 @@ int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
 	retval = -ESRCH;
 	do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
 		int err = group_send_sig_info(sig, info, p);
+
 		success |= !err;
 		retval = err;
 	} while_each_pid_task(pgrp, PIDTYPE_PGID, p);
@@ -1361,6 +1365,7 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
 int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
 {
 	int error;
+
 	rcu_read_lock();
 	error = kill_pid_info(sig, info, find_vpid(pid));
 	rcu_read_unlock();
@@ -1371,6 +1376,7 @@ static int kill_as_cred_perm(const struct cred *cred,
 			     struct task_struct *target)
 {
 	const struct cred *pcred = __task_cred(target);
+
 	if (!uid_eq(cred->euid, pcred->suid) && !uid_eq(cred->euid, pcred->uid) &&
 	    !uid_eq(cred->uid,  pcred->suid) && !uid_eq(cred->uid,  pcred->uid))
 		return 0;
@@ -1499,6 +1505,7 @@ force_sigsegv(int sig, struct task_struct *p)
 {
 	if (sig == SIGSEGV) {
 		unsigned long flags;
+
 		spin_lock_irqsave(&p->sighand->siglock, flags);
 		p->sighand->action[sig - 1].sa.sa_handler = SIG_DFL;
 		spin_unlock_irqrestore(&p->sighand->siglock, flags);
@@ -2491,7 +2498,6 @@ EXPORT_SYMBOL(sigprocmask);
 EXPORT_SYMBOL(block_all_signals);
 EXPORT_SYMBOL(unblock_all_signals);
 
-
 /*
  * System call entry points.
  */
@@ -2502,6 +2508,7 @@ EXPORT_SYMBOL(unblock_all_signals);
 SYSCALL_DEFINE0(restart_syscall)
 {
 	struct restart_block *restart = &current_thread_info()->restart_block;
+
 	return restart->fn(restart);
 }
 
@@ -2631,6 +2638,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
 		compat_sigset_t new32;
 		sigset_t new_set;
 		int error;
+
 		if (copy_from_user(&new32, nset, sizeof(compat_sigset_t)))
 			return -EFAULT;
 
@@ -2643,6 +2651,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
 	}
 	if (oset) {
 		compat_sigset_t old32;
+
 		sigset_to_compat(&old32, &old_set);
 		if (copy_to_user(oset, &old32, sizeof(compat_sigset_t)))
 			return -EFAULT;
@@ -2680,6 +2689,7 @@ SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize)
 {
 	sigset_t set;
 	int err = do_sigpending(&set, sigsetsize);
+
 	if (!err && copy_to_user(uset, &set, sigsetsize))
 		err = -EFAULT;
 	return err;
@@ -2692,8 +2702,10 @@ COMPAT_SYSCALL_DEFINE2(rt_sigpending, compat_sigset_t __user *, uset,
 #ifdef __BIG_ENDIAN
 	sigset_t set;
 	int err = do_sigpending(&set, sigsetsize);
+
 	if (!err) {
 		compat_sigset_t set32;
+
 		sigset_to_compat(&set32, &set);
 		/* we can get here only if sigsetsize <= sizeof(set) */
 		if (copy_to_user(uset, &set32, sigsetsize))
@@ -3009,6 +3021,7 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
 		siginfo_t __user *, uinfo)
 {
 	siginfo_t info;
+
 	if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
 		return -EFAULT;
 	return do_rt_sigqueueinfo(pid, sig, &info);
@@ -3022,6 +3035,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo,
 {
 	siginfo_t info;
 	int ret = copy_siginfo_from_user32(&info, uinfo);
+
 	if (unlikely(ret))
 		return ret;
 	return do_rt_sigqueueinfo(pid, sig, &info);
@@ -3203,6 +3217,7 @@ do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long sp
 out:
 	return error;
 }
+
 SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss, stack_t __user *, uoss)
 {
 	return do_sigaltstack(uss, uoss, current_user_stack_pointer());
@@ -3218,6 +3233,7 @@ int restore_altstack(const stack_t __user *uss)
 int __save_altstack(stack_t __user *uss, unsigned long sp)
 {
 	struct task_struct *t = current;
+
 	return  __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) |
 		__put_user(sas_ss_flags(sp), &uss->ss_flags) |
 		__put_user(t->sas_ss_size, &uss->ss_size);
@@ -3268,6 +3284,7 @@ int compat_restore_altstack(const compat_stack_t __user *uss)
 int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
 {
 	struct task_struct *t = current;
+
 	return  __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), &uss->ss_sp) |
 		__put_user(sas_ss_flags(sp), &uss->ss_flags) |
 		__put_user(t->sas_ss_size, &uss->ss_size);
@@ -3372,6 +3389,7 @@ SYSCALL_DEFINE4(rt_sigaction, int, sig,
 out:
 	return ret;
 }
+
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 		       const struct compat_sigaction __user *, act,
@@ -3391,6 +3409,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 
 	if (act) {
 		compat_uptr_t handler;
+
 		ret = get_user(handler, &act->sa_handler);
 		new_ka.sa.sa_handler = compat_ptr(handler);
 #ifdef __ARCH_HAS_SA_RESTORER
@@ -3431,6 +3450,7 @@ SYSCALL_DEFINE3(sigaction, int, sig,
 
 	if (act) {
 		old_sigset_t mask;
+
 		if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
 		    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
 		    __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
@@ -3610,6 +3630,7 @@ COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_
 SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
 {
 	sigset_t blocked;
+
 	siginitset(&blocked, mask);
 	return sigsuspend(&blocked);
 }
@@ -3618,6 +3639,7 @@ SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
 SYSCALL_DEFINE3(sigsuspend, int, unused1, int, unused2, old_sigset_t, mask)
 {
 	sigset_t blocked;
+
 	siginitset(&blocked, mask);
 	return sigsuspend(&blocked);
 }
@@ -3646,6 +3668,7 @@ kdb_send_sig_info(struct task_struct *t, struct siginfo *info)
 {
 	static struct task_struct *kdb_prev_t;
 	int sig, new_t;
+
 	if (!spin_trylock(&t->sighand->siglock)) {
 		kdb_printf("Can't do kill command now.\n"
 			   "The sigmask lock is held somewhere else in "
-- 
2.1.2


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

* [UNNECESSARY PATCH 03/16] signal: Move EXPORT_SYMBOL after function definition
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 01/16] signal: whitespace neatening Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 02/16] signal: vertical line neatening Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 04/16] signal: Use pr_<level> Joe Perches
                               ` (12 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Just neatening.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index abb2bcd..969c6ba 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -160,6 +160,7 @@ void recalc_sigpending(void)
 	if (!recalc_sigpending_tsk(current) && !freezing(current))
 		clear_thread_flag(TIF_SIGPENDING);
 }
+EXPORT_SYMBOL(recalc_sigpending);
 
 /* Given the mask, find the first available signal that should be serviced. */
 
@@ -430,6 +431,7 @@ void flush_signals(struct task_struct *t)
 	__flush_signals(t);
 	spin_unlock_irqrestore(&t->sighand->siglock, flags);
 }
+EXPORT_SYMBOL(flush_signals);
 
 static void __flush_itimer_signals(struct sigpending *pending)
 {
@@ -529,6 +531,7 @@ block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
 	current->notifier = notifier;
 	spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
+EXPORT_SYMBOL(block_all_signals);
 
 /* Notify the system that blocking has ended. */
 
@@ -543,6 +546,7 @@ unblock_all_signals(void)
 	recalc_sigpending();
 	spin_unlock_irqrestore(&current->sighand->siglock, flags);
 }
+EXPORT_SYMBOL(unblock_all_signals);
 
 static void collect_signal(int sig, struct sigpending *list, siginfo_t *info)
 {
@@ -676,6 +680,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
 	}
 	return signr;
 }
+EXPORT_SYMBOL_GPL(dequeue_signal);
 
 /*
  * Tell a process that it has a new active signal..
@@ -1478,6 +1483,7 @@ int send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 
 	return do_send_sig_info(sig, info, p, false);
 }
+EXPORT_SYMBOL(send_sig_info);
 
 #define __si_special(priv)				\
 	((priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO)
@@ -1487,12 +1493,14 @@ send_sig(int sig, struct task_struct *p, int priv)
 {
 	return send_sig_info(sig, __si_special(priv), p);
 }
+EXPORT_SYMBOL(send_sig);
 
 void
 force_sig(int sig, struct task_struct *p)
 {
 	force_sig_info(sig, SEND_SIG_PRIV, p);
 }
+EXPORT_SYMBOL(force_sig);
 
 /*
  * When things go south during signal handling, we
@@ -2488,16 +2496,6 @@ out:
 	}
 }
 
-EXPORT_SYMBOL(recalc_sigpending);
-EXPORT_SYMBOL_GPL(dequeue_signal);
-EXPORT_SYMBOL(flush_signals);
-EXPORT_SYMBOL(force_sig);
-EXPORT_SYMBOL(send_sig);
-EXPORT_SYMBOL(send_sig_info);
-EXPORT_SYMBOL(sigprocmask);
-EXPORT_SYMBOL(block_all_signals);
-EXPORT_SYMBOL(unblock_all_signals);
-
 /*
  * System call entry points.
  */
@@ -2585,6 +2583,7 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
 	__set_current_blocked(&newset);
 	return 0;
 }
+EXPORT_SYMBOL(sigprocmask);
 
 /**
  *  sys_rt_sigprocmask - change the list of currently blocked signals
-- 
2.1.2


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

* [UNNECESSARY PATCH 04/16] signal: Use pr_<level>
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (2 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 03/16] signal: Move EXPORT_SYMBOL after function definition Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 05/16] signal: Move case statements to separate lines and for loop neatening Joe Perches
                               ` (11 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Use the more current logging style.

Add pr_fmt to prefix messages with "signal: "
Remove local use of DEFINE_RATELIMIT_STATE and __ratelimit and
use pr_info_ratelimited instead.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 969c6ba..0efde2d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -10,6 +10,8 @@
  *		to allow signals to be sent reliably.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <linux/init.h>
@@ -216,16 +218,11 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 
 static inline void print_dropped_signal(int sig)
 {
-	static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10);
-
 	if (!print_fatal_signals)
 		return;
 
-	if (!__ratelimit(&ratelimit_state))
-		return;
-
-	printk(KERN_INFO "%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
-	       current->comm, current->pid, sig);
+	pr_info_ratelimited("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
+			    current->comm, current->pid, sig);
 }
 
 /**
@@ -1147,10 +1144,10 @@ static void print_fatal_signal(int signr)
 {
 	struct pt_regs *regs = signal_pt_regs();
 
-	printk(KERN_INFO "potentially unexpected fatal signal %d.\n", signr);
+	pr_info("potentially unexpected fatal signal %d\n", signr);
 
 #if defined(__i386__) && !defined(__arch_um__)
-	printk(KERN_INFO "code at %08lx: ", regs->ip);
+	pr_info("code at %08lx:", regs->ip);
 	{
 		int i;
 
@@ -1159,10 +1156,10 @@ static void print_fatal_signal(int signr)
 
 			if (get_user(insn, (unsigned char *)(regs->ip + i)))
 				break;
-			printk(KERN_CONT "%02x ", insn);
+			pr_cont(" %02x", insn);
 		}
 	}
-	printk(KERN_CONT "\n");
+	pr_cont("\n");
 #endif
 	preempt_disable();
 	show_regs(regs);
-- 
2.1.2


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

* [UNNECESSARY PATCH 05/16] signal: Move case statements to separate lines and for loop neatening
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (3 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 04/16] signal: Use pr_<level> Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 06/16] signal: Use consistent function definition style Joe Perches
                               ` (10 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Use the normal style for case statements and for loops

Make the initialization and for loop test more expected style too.
Add a break to the last case.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 0efde2d..49562b2 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -110,21 +110,26 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
 
 	switch (_NSIG_WORDS) {
 	default:
-		for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
+		ready = 0;
+		for (i = _NSIG_WORDS; i >= 0; i--)
 			ready |= signal->sig[i] & ~blocked->sig[i];
 		break;
 
-	case 4: ready  = signal->sig[3] & ~blocked->sig[3];
+	case 4:
+		ready  = signal->sig[3] & ~blocked->sig[3];
 		ready |= signal->sig[2] & ~blocked->sig[2];
 		ready |= signal->sig[1] & ~blocked->sig[1];
 		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 2: ready  = signal->sig[1] & ~blocked->sig[1];
+	case 2:
+		ready  = signal->sig[1] & ~blocked->sig[1];
 		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 1: ready  = signal->sig[0] & ~blocked->sig[0];
+	case 1:
+		ready  = signal->sig[0] & ~blocked->sig[0];
+		break;
 	}
 	return ready !=	0;
 }
-- 
2.1.2


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

* [UNNECESSARY PATCH 06/16] signal: Use consistent function definition style
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (4 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 05/16] signal: Move case statements to separate lines and for loop neatening Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 07/16] signal: Add braces Joe Perches
                               ` (9 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

This file has a mixture of function definition styles.
Standardize on having the return value on the same line.

Convert the SYSCALL style to have the declarator on the
first line and the arguments on separate lines.

Remove an unnecessary #else block by moving #ifdef/#endif
inside a function.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 153 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 92 insertions(+), 61 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 49562b2..eb0a7c5 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -359,8 +359,8 @@ static bool task_participate_group_stop(struct task_struct *task)
  * - this may be called without locks if and only if t == current, otherwise an
  *   appropriate lock must be held to stop the target task from exiting
  */
-static struct sigqueue *
-__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit)
+static struct sigqueue *__sigqueue_alloc(int sig, struct task_struct *t,
+					 gfp_t flags, int override_rlimit)
 {
 	struct sigqueue *q = NULL;
 	struct user_struct *user;
@@ -483,8 +483,7 @@ void ignore_signals(struct task_struct *t)
  * Flush all handlers for a task.
  */
 
-void
-flush_signal_handlers(struct task_struct *t, int force_default)
+void flush_signal_handlers(struct task_struct *t, int force_default)
 {
 	int i;
 	struct k_sigaction *ka = &t->sighand->action[0];
@@ -522,8 +521,7 @@ int unhandled_signal(struct task_struct *tsk, int sig)
  * allowed.  priv is a pointer to private data that the notifier routine
  * can use to determine if the signal should be blocked or not.
  */
-void
-block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
+void block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
 {
 	unsigned long flags;
 
@@ -537,8 +535,7 @@ EXPORT_SYMBOL(block_all_signals);
 
 /* Notify the system that blocking has ended. */
 
-void
-unblock_all_signals(void)
+void unblock_all_signals(void)
 {
 	unsigned long flags;
 
@@ -1007,9 +1004,10 @@ static inline int legacy_queue(struct sigpending *signals, int sig)
 	return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
 }
 
-#ifdef CONFIG_USER_NS
-static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_struct *t)
+static inline void userns_fixup_signal_uid(struct siginfo *info,
+					   struct task_struct *t)
 {
+#ifdef CONFIG_USER_NS
 	if (current_user_ns() == task_cred_xxx(t, user_ns))
 		return;
 
@@ -1018,15 +1016,11 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str
 
 	rcu_read_lock();
 	info->si_uid = from_kuid_munged(task_cred_xxx(t, user_ns),
-					make_kuid(current_user_ns(), info->si_uid));
+					make_kuid(current_user_ns(),
+						  info->si_uid));
 	rcu_read_unlock();
-}
-#else
-static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_struct *t)
-{
-	return;
-}
 #endif
+}
 
 static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 			 int group, int from_ancestor_ns)
@@ -1180,14 +1174,13 @@ static int __init setup_print_fatal_signals(char *str)
 
 __setup("print-fatal-signals=", setup_print_fatal_signals);
 
-int
-__group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
+int __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 {
 	return send_signal(sig, info, p, 1);
 }
 
-static int
-specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
+static int specific_send_sig_info(int sig, struct siginfo *info,
+				  struct task_struct *t)
 {
 	return send_signal(sig, info, t, 0);
 }
@@ -1217,8 +1210,7 @@ int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p,
  * We don't want to have recursive SIGSEGV's etc, for example,
  * that is why we also clear SIGNAL_UNKILLABLE.
  */
-int
-force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
+int force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
 {
 	unsigned long int flags;
 	int ret, blocked, ignored;
@@ -1490,15 +1482,13 @@ EXPORT_SYMBOL(send_sig_info);
 #define __si_special(priv)				\
 	((priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO)
 
-int
-send_sig(int sig, struct task_struct *p, int priv)
+int send_sig(int sig, struct task_struct *p, int priv)
 {
 	return send_sig_info(sig, __si_special(priv), p);
 }
 EXPORT_SYMBOL(send_sig);
 
-void
-force_sig(int sig, struct task_struct *p)
+void force_sig(int sig, struct task_struct *p)
 {
 	force_sig_info(sig, SEND_SIG_PRIV, p);
 }
@@ -1510,8 +1500,7 @@ EXPORT_SYMBOL(force_sig);
  * the problem was already a SIGSEGV, we'll want to
  * make sure we don't even try to deliver the signal..
  */
-int
-force_sigsegv(int sig, struct task_struct *p)
+int force_sigsegv(int sig, struct task_struct *p)
 {
 	if (sig == SIGSEGV) {
 		unsigned long flags;
@@ -2594,8 +2583,11 @@ EXPORT_SYMBOL(sigprocmask);
  *  @oset: previous value of signal mask if non-null
  *  @sigsetsize: size of sigset_t type
  */
-SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset,
-		sigset_t __user *, oset, size_t, sigsetsize)
+SYSCALL_DEFINE4(rt_sigprocmask,
+		int, how,
+		sigset_t __user *, nset,
+		sigset_t __user *, oset,
+		size_t, sigsetsize)
 {
 	sigset_t old_set, new_set;
 	int error;
@@ -2625,8 +2617,11 @@ SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset,
 }
 
 #ifdef CONFIG_COMPAT
-COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
-		       compat_sigset_t __user *, oset, compat_size_t, sigsetsize)
+COMPAT_SYSCALL_DEFINE4(rt_sigprocmask,
+		       int, how,
+		       compat_sigset_t __user *, nset,
+		       compat_sigset_t __user *, oset,
+		       compat_size_t, sigsetsize)
 {
 #ifdef __BIG_ENDIAN
 	sigset_t old_set = current->blocked;
@@ -2686,7 +2681,9 @@ static int do_sigpending(void *set, unsigned long sigsetsize)
  *  @uset: stores pending signals
  *  @sigsetsize: size of sigset_t type or larger
  */
-SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize)
+SYSCALL_DEFINE2(rt_sigpending,
+		sigset_t __user *, uset,
+		size_t, sigsetsize)
 {
 	sigset_t set;
 	int err = do_sigpending(&set, sigsetsize);
@@ -2697,7 +2694,8 @@ SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize)
 }
 
 #ifdef CONFIG_COMPAT
-COMPAT_SYSCALL_DEFINE2(rt_sigpending, compat_sigset_t __user *, uset,
+COMPAT_SYSCALL_DEFINE2(rt_sigpending,
+		       compat_sigset_t __user *, uset,
 		       compat_size_t, sigsetsize)
 {
 #ifdef __BIG_ENDIAN
@@ -2868,8 +2866,10 @@ int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
  *  @uts: upper bound on process time suspension
  *  @sigsetsize: size of sigset_t type
  */
-SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
-		siginfo_t __user *, uinfo, const struct timespec __user *, uts,
+SYSCALL_DEFINE4(rt_sigtimedwait,
+		const sigset_t __user *, uthese,
+		siginfo_t __user *, uinfo,
+		const struct timespec __user *, uts,
 		size_t, sigsetsize)
 {
 	sigset_t these;
@@ -2904,7 +2904,9 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
  *  @pid: the PID of the process
  *  @sig: signal to be sent
  */
-SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
+SYSCALL_DEFINE2(kill,
+		pid_t, pid,
+		int, sig)
 {
 	struct siginfo info;
 
@@ -2917,8 +2919,8 @@ SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
 	return kill_something_info(sig, &info, pid);
 }
 
-static int
-do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info)
+static int do_send_specific(pid_t tgid, pid_t pid, int sig,
+			    struct siginfo *info)
 {
 	struct task_struct *p;
 	int error = -ESRCH;
@@ -2970,7 +2972,10 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig)
  *  exists but it's not belonging to the target process anymore. This
  *  method solves the problem of threads exiting and PIDs getting reused.
  */
-SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
+SYSCALL_DEFINE3(tgkill,
+		pid_t, tgid,
+		pid_t, pid,
+		int, sig)
 {
 	/* This is only valid for single tasks */
 	if (pid <= 0 || tgid <= 0)
@@ -2986,7 +2991,9 @@ SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
  *
  *  Send a signal to only one task, even if it's a CLONE_THREAD task.
  */
-SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
+SYSCALL_DEFINE2(tkill,
+		pid_t, pid,
+		int, sig)
 {
 	/* This is only valid for single tasks */
 	if (pid <= 0)
@@ -3018,7 +3025,9 @@ static int do_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t *info)
  *  @sig: signal to be sent
  *  @uinfo: signal info to be sent
  */
-SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
+SYSCALL_DEFINE3(rt_sigqueueinfo,
+		pid_t, pid,
+		int, sig,
 		siginfo_t __user *, uinfo)
 {
 	siginfo_t info;
@@ -3063,7 +3072,10 @@ static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
 	return do_send_specific(tgid, pid, sig, info);
 }
 
-SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig,
+SYSCALL_DEFINE4(rt_tgsigqueueinfo,
+		pid_t, tgid,
+		pid_t, pid,
+		int, sig,
 		siginfo_t __user *, uinfo)
 {
 	siginfo_t info;
@@ -3153,8 +3165,8 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
 	return 0;
 }
 
-static int
-do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)
+static int do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+			  unsigned long sp)
 {
 	stack_t oss;
 	int error;
@@ -3219,7 +3231,9 @@ out:
 	return error;
 }
 
-SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss, stack_t __user *, uoss)
+SYSCALL_DEFINE2(sigaltstack,
+		const stack_t __user *, uss,
+		stack_t __user *, uoss)
 {
 	return do_sigaltstack(uss, uoss, current_user_stack_pointer());
 }
@@ -3298,7 +3312,8 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
  *  sys_sigpending - examine pending signals
  *  @set: where mask of pending signal is returned
  */
-SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
+SYSCALL_DEFINE1(sigpending,
+		old_sigset_t __user *, set)
 {
 	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t));
 }
@@ -3316,7 +3331,9 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
  * others support only sys_rt_sigprocmask.
  */
 
-SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
+SYSCALL_DEFINE3(sigprocmask,
+		int, how,
+		old_sigset_t __user *, nset,
 		old_sigset_t __user *, oset)
 {
 	old_sigset_t old_set, new_set;
@@ -3364,7 +3381,8 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
  *  @oact: used to save the previous sigaction
  *  @sigsetsize: size of sigset_t type
  */
-SYSCALL_DEFINE4(rt_sigaction, int, sig,
+SYSCALL_DEFINE4(rt_sigaction,
+		int, sig,
 		const struct sigaction __user *, act,
 		struct sigaction __user *, oact,
 		size_t, sigsetsize)
@@ -3392,7 +3410,8 @@ out:
 }
 
 #ifdef CONFIG_COMPAT
-COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
+COMPAT_SYSCALL_DEFINE4(rt_sigaction,
+		       int, sig,
 		       const struct compat_sigaction __user *, act,
 		       struct compat_sigaction __user *, oact,
 		       compat_size_t, sigsetsize)
@@ -3442,7 +3461,8 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 #endif /* !CONFIG_ODD_RT_SIGACTION */
 
 #ifdef CONFIG_OLD_SIGACTION
-SYSCALL_DEFINE3(sigaction, int, sig,
+SYSCALL_DEFINE3(sigaction,
+		int, sig,
 		const struct old_sigaction __user *, act,
 		struct old_sigaction __user *, oact)
 {
@@ -3479,7 +3499,8 @@ SYSCALL_DEFINE3(sigaction, int, sig,
 }
 #endif
 #ifdef CONFIG_COMPAT_OLD_SIGACTION
-COMPAT_SYSCALL_DEFINE3(sigaction, int, sig,
+COMPAT_SYSCALL_DEFINE3(sigaction,
+		       int, sig,
 		       const struct compat_old_sigaction __user *, act,
 		       struct compat_old_sigaction __user *, oact)
 {
@@ -3531,7 +3552,8 @@ SYSCALL_DEFINE0(sgetmask)
 	return current->blocked.sig[0];
 }
 
-SYSCALL_DEFINE1(ssetmask, int, newmask)
+SYSCALL_DEFINE1(ssetmask,
+		int, newmask)
 {
 	int old = current->blocked.sig[0];
 	sigset_t newset;
@@ -3547,7 +3569,9 @@ SYSCALL_DEFINE1(ssetmask, int, newmask)
 /*
  * For backwards compatibility.  Functionality superseded by sigaction.
  */
-SYSCALL_DEFINE2(signal, int, sig, __sighandler_t, handler)
+SYSCALL_DEFINE2(signal,
+		int, sig,
+		__sighandler_t, handler)
 {
 	struct k_sigaction new_sa, old_sa;
 	int ret;
@@ -3592,7 +3616,9 @@ int sigsuspend(sigset_t *set)
  *  @unewset: new signal mask value
  *  @sigsetsize: size of sigset_t type
  */
-SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
+SYSCALL_DEFINE2(rt_sigsuspend,
+		sigset_t __user *, unewset,
+		size_t, sigsetsize)
 {
 	sigset_t newset;
 
@@ -3606,7 +3632,9 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
 }
 
 #ifdef CONFIG_COMPAT
-COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_size_t, sigsetsize)
+COMPAT_SYSCALL_DEFINE2(rt_sigsuspend,
+		       compat_sigset_t __user *, unewset,
+		       compat_size_t, sigsetsize)
 {
 #ifdef __BIG_ENDIAN
 	sigset_t newset;
@@ -3628,7 +3656,8 @@ COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_
 #endif
 
 #ifdef CONFIG_OLD_SIGSUSPEND
-SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
+SYSCALL_DEFINE1(sigsuspend,
+		old_sigset_t, mask)
 {
 	sigset_t blocked;
 
@@ -3637,7 +3666,10 @@ SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
 }
 #endif
 #ifdef CONFIG_OLD_SIGSUSPEND3
-SYSCALL_DEFINE3(sigsuspend, int, unused1, int, unused2, old_sigset_t, mask)
+SYSCALL_DEFINE3(sigsuspend,
+		int, unused1,
+		int, unused2,
+		old_sigset_t, mask)
 {
 	sigset_t blocked;
 
@@ -3664,8 +3696,7 @@ void __init signals_init(void)
  * available before calling the main signal code, to avoid kdb
  * deadlocks.
  */
-void
-kdb_send_sig_info(struct task_struct *t, struct siginfo *info)
+void kdb_send_sig_info(struct task_struct *t, struct siginfo *info)
 {
 	static struct task_struct *kdb_prev_t;
 	int sig, new_t;
-- 
2.1.2


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

* [UNNECESSARY PATCH 07/16] signal: Add braces
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (5 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 06/16] signal: Use consistent function definition style Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 08/16] signal: Remove unnecessary return Joe Perches
                               ` (8 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Add braces to arms where other arms have them.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index eb0a7c5..baddb92 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -934,15 +934,15 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 	 * If the main thread wants the signal, it gets first crack.
 	 * Probably the least surprising to the average bear.
 	 */
-	if (wants_signal(sig, p))
+	if (wants_signal(sig, p)) {
 		t = p;
-	else if (!group || thread_group_empty(p))
+	} else if (!group || thread_group_empty(p)) {
 		/*
 		 * There is just one thread and it does not need to be woken.
 		 * It will dequeue unblocked signals before it runs again.
 		 */
 		return;
-	else {
+	} else {
 		/*
 		 * Otherwise try to find a suitable thread.
 		 */
@@ -1411,8 +1411,9 @@ int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid,
 		if (lock_task_sighand(p, &flags)) {
 			ret = __send_signal(sig, info, p, 1, 0);
 			unlock_task_sighand(p, &flags);
-		} else
+		} else {
 			ret = -ESRCH;
+		}
 	}
 out_unlock:
 	rcu_read_unlock();
@@ -1675,11 +1676,11 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
 	info.si_stime = cputime_to_clock_t(stime + tsk->signal->stime);
 
 	info.si_status = tsk->exit_code & 0x7f;
-	if (tsk->exit_code & 0x80)
+	if (tsk->exit_code & 0x80) {
 		info.si_code = CLD_DUMPED;
-	else if (tsk->exit_code & 0x7f)
+	} else if (tsk->exit_code & 0x7f) {
 		info.si_code = CLD_KILLED;
-	else {
+	} else {
 		info.si_code = CLD_EXITED;
 		info.si_status = tsk->exit_code >> 8;
 	}
-- 
2.1.2


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

* [UNNECESSARY PATCH 08/16] signal: Remove unnecessary return
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (6 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 07/16] signal: Add braces Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 09/16] signal: Use include <linux not <asm Joe Perches
                               ` (7 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

void functions don't need returns and end of function definition.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index baddb92..ccd57a3 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -996,7 +996,6 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 	 * Tell the chosen thread to wake up and dequeue it.
 	 */
 	signal_wake_up(t, sig == SIGKILL);
-	return;
 }
 
 static inline int legacy_queue(struct sigpending *signals, int sig)
-- 
2.1.2


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

* [UNNECESSARY PATCH 09/16] signal: Use include <linux not <asm
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (7 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 08/16] signal: Remove unnecessary return Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 10/16] signal: Remove unnecessary parentheses from function pointer call Joe Perches
                               ` (6 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Use the more common include path.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index ccd57a3..74bd4dd 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -36,12 +36,12 @@
 #include <linux/compat.h>
 #include <linux/cn_proc.h>
 #include <linux/compiler.h>
+#include <linux/uaccess.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/signal.h>
 
 #include <asm/param.h>
-#include <asm/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/siginfo.h>
 #include <asm/cacheflush.h>
-- 
2.1.2


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

* [UNNECESSARY PATCH 10/16] signal: Remove unnecessary parentheses from function pointer call
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (8 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 09/16] signal: Use include <linux not <asm Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 11/16] signal: Add parenthese around sizeof argument Joe Perches
                               ` (5 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

These don't add clarity so remove them.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 74bd4dd..d782fa0 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -592,7 +592,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
 	if (sig) {
 		if (current->notifier) {
 			if (sigismember(current->notifier_mask, sig)) {
-				if (!(current->notifier)(current->notifier_data)) {
+				if (!current->notifier(current->notifier_data)) {
 					clear_thread_flag(TIF_SIGPENDING);
 					return 0;
 				}
-- 
2.1.2


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

* [UNNECESSARY PATCH 11/16] signal: Add parenthese around sizeof argument
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (9 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 10/16] signal: Remove unnecessary parentheses from function pointer call Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 12/16] signal: 80 column wrapping Joe Perches
                               ` (4 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Use normal kernel style.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index d782fa0..1946fa1 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1957,7 +1957,7 @@ static void ptrace_do_notify(int signr, int exit_code, int why)
 {
 	siginfo_t info;
 
-	memset(&info, 0, sizeof info);
+	memset(&info, 0, sizeof(info));
 	info.si_signo = signr;
 	info.si_code = exit_code;
 	info.si_pid = task_pid_vnr(current);
-- 
2.1.2


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

* [UNNECESSARY PATCH 12/16] signal: 80 column wrapping
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (10 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 11/16] signal: Add parenthese around sizeof argument Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 13/16] signal: Move label to first column Joe Perches
                               ` (3 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Just neaten some lines that extend beyond 80 columns.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 1946fa1..15ce05d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -983,7 +983,8 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 			signal->group_stop_count = 0;
 			t = p;
 			do {
-				task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK);
+				task_clear_jobctl_pending(t,
+							  JOBCTL_PENDING_MASK);
 				sigaddset(&t->pending.signal, SIGKILL);
 				signal_wake_up(t, 1);
 			} while_each_thread(p, t);
@@ -1079,7 +1080,8 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
 			q->info.si_code = SI_USER;
 			q->info.si_pid = task_tgid_nr_ns(current,
 							 task_active_pid_ns(t));
-			q->info.si_uid = from_kuid_munged(current_user_ns(), current_uid());
+			q->info.si_uid = from_kuid_munged(current_user_ns(),
+							  current_uid());
 			break;
 		case (unsigned long)SEND_SIG_PRIV:
 			q->info.si_signo = sig;
@@ -1375,8 +1377,10 @@ static int kill_as_cred_perm(const struct cred *cred,
 {
 	const struct cred *pcred = __task_cred(target);
 
-	if (!uid_eq(cred->euid, pcred->suid) && !uid_eq(cred->euid, pcred->uid) &&
-	    !uid_eq(cred->uid,  pcred->suid) && !uid_eq(cred->uid,  pcred->uid))
+	if (!uid_eq(cred->euid, pcred->suid) &&
+	    !uid_eq(cred->euid, pcred->uid) &&
+	    !uid_eq(cred->uid,  pcred->suid) &&
+	    !uid_eq(cred->uid,  pcred->uid))
 		return 0;
 	return 1;
 }
@@ -1752,7 +1756,8 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
 	 */
 	rcu_read_lock();
 	info.si_pid = task_pid_nr_ns(tsk, task_active_pid_ns(parent));
-	info.si_uid = from_kuid_munged(task_cred_xxx(parent, user_ns), task_uid(tsk));
+	info.si_uid = from_kuid_munged(task_cred_xxx(parent, user_ns),
+				       task_uid(tsk));
 	rcu_read_unlock();
 
 	task_cputime(tsk, &utime, &stime);
@@ -1816,8 +1821,8 @@ static inline int may_ptrace_stop(void)
  */
 static int sigkill_pending(struct task_struct *tsk)
 {
-	return	sigismember(&tsk->pending.signal, SIGKILL) ||
-		sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
+	return sigismember(&tsk->pending.signal, SIGKILL) ||
+	       sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
 }
 
 /*
@@ -2764,7 +2769,8 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 		 * Other callers might not initialize the si_lsb field,
 		 * so check explicitly for the right codes here.
 		 */
-		if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
+		if (from->si_code == BUS_MCEERR_AR ||
+		    from->si_code == BUS_MCEERR_AO)
 			err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
 #endif
 		break;
@@ -3201,7 +3207,9 @@ static int do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
 		 *	  way that worked) - this fix preserves that older
 		 *	  mechanism.
 		 */
-		if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
+		if (ss_flags != SS_DISABLE &&
+		    ss_flags != SS_ONSTACK &&
+		    ss_flags != 0)
 			goto out;
 
 		if (ss_flags == SS_DISABLE) {
@@ -3280,7 +3288,8 @@ COMPAT_SYSCALL_DEFINE2(sigaltstack,
 			     compat_user_stack_pointer());
 	set_fs(seg);
 	if (ret >= 0 && uoss_ptr)  {
-		if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(compat_stack_t)) ||
+		if (!access_ok(VERIFY_WRITE, uoss_ptr,
+			       sizeof(compat_stack_t)) ||
 		    __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) ||
 		    __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) ||
 		    __put_user(uoss.ss_size, &uoss_ptr->ss_size))
@@ -3300,9 +3309,10 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
 {
 	struct task_struct *t = current;
 
-	return  __put_user(ptr_to_compat((void __user *)t->sas_ss_sp), &uss->ss_sp) |
-		__put_user(sas_ss_flags(sp), &uss->ss_flags) |
-		__put_user(t->sas_ss_size, &uss->ss_size);
+	return __put_user(ptr_to_compat((void __user *)t->sas_ss_sp),
+			  &uss->ss_sp) |
+	       __put_user(sas_ss_flags(sp), &uss->ss_flags) |
+	       __put_user(t->sas_ss_size, &uss->ss_size);
 }
 #endif
 
-- 
2.1.2


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

* [UNNECESSARY PATCH 13/16] signal: Move label to first column
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (11 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 12/16] signal: 80 column wrapping Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 14/16] signal: Convert for (;;) to do {} while Joe Perches
                               ` (2 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Use the more common kernel style.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 15ce05d..9b133eb 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -566,7 +566,7 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info)
 	sigdelset(&list->signal, sig);
 
 	if (first) {
-	still_pending:
+still_pending:
 		list_del_init(&first->list);
 		copy_siginfo(info, &first->info);
 		__sigqueue_free(first);
-- 
2.1.2


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

* [UNNECESSARY PATCH 14/16] signal: Convert for (;;) to do {} while
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (12 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 13/16] signal: Move label to first column Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 15/16] signal: Isolate returns by adding blank lines Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 16/16] signal: Coalesce kdb_printf formats Joe Perches
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

So the return value is at end of the function.

No change of compiled x86-64 object.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 9b133eb..739d261 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1345,21 +1345,21 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
 	int error = -ESRCH;
 	struct task_struct *p;
 
-	for (;;) {
+	do {
 		rcu_read_lock();
 		p = pid_task(pid, PIDTYPE_PID);
 		if (p)
 			error = group_send_sig_info(sig, info, p);
 		rcu_read_unlock();
-		if (likely(!p || error != -ESRCH))
-			return error;
 
 		/*
-		 * The task was unhashed in between, try again.  If it
-		 * is dead, pid_task() will return NULL, if we race with
-		 * de_thread() it will find the new leader.
+		 * If the task is dead, pid_task() will return NULL
+		 * If we race with de_thread() it will find the new leader.
+		 * The task was unhashed in between, try again.
 		 */
-	}
+	} while (unlikely(p && error == -ESRCH));
+
+	return error;
 }
 
 int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
-- 
2.1.2


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

* [UNNECESSARY PATCH 15/16] signal: Isolate returns by adding blank lines
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (13 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 14/16] signal: Convert for (;;) to do {} while Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  2014-11-16 20:09             ` [UNNECESSARY PATCH 16/16] signal: Coalesce kdb_printf formats Joe Perches
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Make the return statements a bit more obvious.

Move initializations to variable definitions where appropriate
and separate them when not.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 52 +++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 41 insertions(+), 11 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 739d261..1b0d3b0 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -131,6 +131,7 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
 		ready  = signal->sig[0] & ~blocked->sig[0];
 		break;
 	}
+
 	return ready !=	0;
 }
 
@@ -677,6 +678,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
 		do_schedule_next_timer(info);
 		spin_lock(&tsk->sighand->siglock);
 	}
+
 	return signr;
 }
 EXPORT_SYMBOL_GPL(dequeue_signal);
@@ -728,6 +730,7 @@ static int flush_sigqueue_mask(sigset_t *mask, struct sigpending *s)
 			__sigqueue_free(q);
 		}
 	}
+
 	return 1;
 }
 
@@ -739,7 +742,7 @@ static inline int is_si_special(const struct siginfo *info)
 static inline bool si_fromuser(const struct siginfo *info)
 {
 	return info == SEND_SIG_NOINFO ||
-		(!is_si_special(info) && SI_FROMUSER(info));
+	       (!is_si_special(info) && SI_FROMUSER(info));
 }
 
 /*
@@ -1327,16 +1330,16 @@ int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
 {
 	struct task_struct *p = NULL;
-	int retval, success;
+	int retval = -ESRCH;
+	int success = 0;
 
-	success = 0;
-	retval = -ESRCH;
 	do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
 		int err = group_send_sig_info(sig, info, p);
 
 		success |= !err;
 		retval = err;
 	} while_each_pid_task(pgrp, PIDTYPE_PGID, p);
+
 	return success ? 0 : retval;
 }
 
@@ -1369,6 +1372,7 @@ int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
 	rcu_read_lock();
 	error = kill_pid_info(sig, info, find_vpid(pid));
 	rcu_read_unlock();
+
 	return error;
 }
 
@@ -1514,6 +1518,7 @@ int force_sigsegv(int sig, struct task_struct *p)
 		spin_unlock_irqrestore(&p->sighand->siglock, flags);
 	}
 	force_sig(SIGSEGV, p);
+
 	return 0;
 }
 
@@ -2372,6 +2377,7 @@ relock:
 	spin_unlock_irq(&sighand->siglock);
 
 	ksig->sig = signr;
+
 	return ksig->sig > 0;
 }
 
@@ -2577,6 +2583,7 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
 	}
 
 	__set_current_blocked(&newset);
+
 	return 0;
 }
 EXPORT_SYMBOL(sigprocmask);
@@ -2657,6 +2664,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigprocmask,
 		if (copy_to_user(oset, &old32, sizeof(compat_sigset_t)))
 			return -EFAULT;
 	}
+
 	return 0;
 #else
 	return sys_rt_sigprocmask(how, (sigset_t __user *)nset,
@@ -2677,6 +2685,7 @@ static int do_sigpending(void *set, unsigned long sigsetsize)
 
 	/* Outside the lock because only this thread touches it.  */
 	sigandsets(set, &current->blocked, set);
+
 	return 0;
 }
 
@@ -2695,6 +2704,7 @@ SYSCALL_DEFINE2(rt_sigpending,
 
 	if (!err && copy_to_user(uset, &set, sigsetsize))
 		err = -EFAULT;
+
 	return err;
 }
 
@@ -2715,6 +2725,7 @@ COMPAT_SYSCALL_DEFINE2(rt_sigpending,
 		if (copy_to_user(uset, &set32, sigsetsize))
 			err = -EFAULT;
 	}
+
 	return err;
 #else
 	return sys_rt_sigpending((sigset_t __user *)uset, sigsetsize);
@@ -2730,9 +2741,12 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 
 	if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
 		return -EFAULT;
-	if (from->si_code < 0)
-		return __copy_to_user(to, from, sizeof(siginfo_t))
-			? -EFAULT : 0;
+	if (from->si_code < 0) {
+		if (__copy_to_user(to, from, sizeof(siginfo_t)))
+			return -EFAULT;
+		return 0;
+	}
+
 	/*
 	 * If you change siginfo_t structure, please be sure
 	 * this code is fixed accordingly.
@@ -2799,6 +2813,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 		err |= __put_user(from->si_uid, &to->si_uid);
 		break;
 	}
+
 	return err;
 }
 
@@ -2861,6 +2876,7 @@ int do_sigtimedwait(const sigset_t *which, siginfo_t *info,
 
 	if (sig)
 		return sig;
+
 	return timeout ? -EINTR : -EAGAIN;
 }
 
@@ -3040,6 +3056,7 @@ SYSCALL_DEFINE3(rt_sigqueueinfo,
 
 	if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
 		return -EFAULT;
+
 	return do_rt_sigqueueinfo(pid, sig, &info);
 }
 
@@ -3050,10 +3067,12 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo,
 		       struct compat_siginfo __user *, uinfo)
 {
 	siginfo_t info;
-	int ret = copy_siginfo_from_user32(&info, uinfo);
+	int ret;
 
+	ret = copy_siginfo_from_user32(&info, uinfo);
 	if (unlikely(ret))
 		return ret;
+
 	return do_rt_sigqueueinfo(pid, sig, &info);
 }
 #endif
@@ -3168,6 +3187,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
 	}
 
 	spin_unlock_irq(&p->sighand->siglock);
+
 	return 0;
 }
 
@@ -3257,9 +3277,9 @@ int __save_altstack(stack_t __user *uss, unsigned long sp)
 {
 	struct task_struct *t = current;
 
-	return  __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) |
-		__put_user(sas_ss_flags(sp), &uss->ss_flags) |
-		__put_user(t->sas_ss_size, &uss->ss_size);
+	return __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) |
+	       __put_user(sas_ss_flags(sp), &uss->ss_flags) |
+	       __put_user(t->sas_ss_size, &uss->ss_size);
 }
 
 #ifdef CONFIG_COMPAT
@@ -3295,6 +3315,7 @@ COMPAT_SYSCALL_DEFINE2(sigaltstack,
 		    __put_user(uoss.ss_size, &uoss_ptr->ss_size))
 			ret = -EFAULT;
 	}
+
 	return ret;
 }
 
@@ -3415,6 +3436,7 @@ SYSCALL_DEFINE4(rt_sigaction,
 		if (copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa)))
 			return -EFAULT;
 	}
+
 out:
 	return ret;
 }
@@ -3465,6 +3487,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction,
 				&oact->sa_restorer);
 #endif
 	}
+
 	return ret;
 }
 #endif
@@ -3547,6 +3570,7 @@ COMPAT_SYSCALL_DEFINE3(sigaction,
 		    __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
 			return -EFAULT;
 	}
+
 	return ret;
 }
 #endif
@@ -3604,6 +3628,7 @@ SYSCALL_DEFINE0(pause)
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
 	}
+
 	return -ERESTARTNOHAND;
 }
 
@@ -3617,6 +3642,7 @@ int sigsuspend(sigset_t *set)
 	current->state = TASK_INTERRUPTIBLE;
 	schedule();
 	set_restore_sigmask();
+
 	return -ERESTARTNOHAND;
 }
 
@@ -3638,6 +3664,7 @@ SYSCALL_DEFINE2(rt_sigsuspend,
 
 	if (copy_from_user(&newset, unewset, sizeof(newset)))
 		return -EFAULT;
+
 	return sigsuspend(&newset);
 }
 
@@ -3657,6 +3684,7 @@ COMPAT_SYSCALL_DEFINE2(rt_sigsuspend,
 	if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t)))
 		return -EFAULT;
 	sigset_from_compat(&newset, &newset32);
+
 	return sigsuspend(&newset);
 #else
 	/* on little-endian bitmaps don't care about granularity */
@@ -3672,6 +3700,7 @@ SYSCALL_DEFINE1(sigsuspend,
 	sigset_t blocked;
 
 	siginitset(&blocked, mask);
+
 	return sigsuspend(&blocked);
 }
 #endif
@@ -3684,6 +3713,7 @@ SYSCALL_DEFINE3(sigsuspend,
 	sigset_t blocked;
 
 	siginitset(&blocked, mask);
+
 	return sigsuspend(&blocked);
 }
 #endif
-- 
2.1.2


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

* [UNNECESSARY PATCH 16/16] signal: Coalesce kdb_printf formats
  2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
                               ` (14 preceding siblings ...)
  2014-11-16 20:09             ` [UNNECESSARY PATCH 15/16] signal: Isolate returns by adding blank lines Joe Perches
@ 2014-11-16 20:09             ` Joe Perches
  15 siblings, 0 replies; 21+ messages in thread
From: Joe Perches @ 2014-11-16 20:09 UTC (permalink / raw)
  To: Ionut Alexa, linux-kernel; +Cc: Al Viro, Andrew Morton

Make the strings a bit more findable.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/signal.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 1b0d3b0..7d5075a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3743,27 +3743,22 @@ void kdb_send_sig_info(struct task_struct *t, struct siginfo *info)
 
 	if (!spin_trylock(&t->sighand->siglock)) {
 		kdb_printf("Can't do kill command now.\n"
-			   "The sigmask lock is held somewhere else in "
-			   "kernel, try again later\n");
+			   "The sigmask lock is held somewhere else in kernel, try again later.\n");
 		return;
 	}
 	spin_unlock(&t->sighand->siglock);
 	new_t = kdb_prev_t != t;
 	kdb_prev_t = t;
 	if (t->state != TASK_RUNNING && new_t) {
-		kdb_printf("Process is not RUNNING, sending a signal from "
-			   "kdb risks deadlock\n"
-			   "on the run queue locks. "
-			   "The signal has _not_ been sent.\n"
-			   "Reissue the kill command if you want to risk "
-			   "the deadlock.\n");
+		kdb_printf("Process is not RUNNING, sending a signal from kdb risks deadlock on the run queue locks. The signal has _not_ been sent.\n"
+			   "Reissue the kill command if you want to risk the deadlock.\n");
 		return;
 	}
 	sig = info->si_signo;
 	if (send_sig_info(sig, info, t))
-		kdb_printf("Fail to deliver Signal %d to process %d.\n",
+		kdb_printf("Fail to deliver Signal %d to process %d\n",
 			   sig, t->pid);
 	else
-		kdb_printf("Signal %d is sent to process %d.\n", sig, t->pid);
+		kdb_printf("Signal %d is sent to process %d\n", sig, t->pid);
 }
 #endif	/* CONFIG_KGDB_KDB */
-- 
2.1.2


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

end of thread, other threads:[~2014-11-16 20:13 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 15:56 [PATCH] kernel:signal.c Fix coding style errors and warnings Ionut Alexa
2014-11-16  2:47 ` Al Viro
     [not found]   ` <CAKF-a2AYAPy2ENaFVanFCWZ_sXHPy_K_uH6zo5apT-kLLaqONA@mail.gmail.com>
2014-11-16 17:08     ` Al Viro
     [not found]       ` <CAKF-a2AhmE4iZHsRNgyp6Le6uaDNSUjbxQENm5sTYD3f24ORnA@mail.gmail.com>
2014-11-16 18:01         ` Al Viro
2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 01/16] signal: whitespace neatening Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 02/16] signal: vertical line neatening Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 03/16] signal: Move EXPORT_SYMBOL after function definition Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 04/16] signal: Use pr_<level> Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 05/16] signal: Move case statements to separate lines and for loop neatening Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 06/16] signal: Use consistent function definition style Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 07/16] signal: Add braces Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 08/16] signal: Remove unnecessary return Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 09/16] signal: Use include <linux not <asm Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 10/16] signal: Remove unnecessary parentheses from function pointer call Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 11/16] signal: Add parenthese around sizeof argument Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 12/16] signal: 80 column wrapping Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 13/16] signal: Move label to first column Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 14/16] signal: Convert for (;;) to do {} while Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 15/16] signal: Isolate returns by adding blank lines Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 16/16] signal: Coalesce kdb_printf formats Joe Perches

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