diff options
author | Jesper Juhl <juhl-lkml@dif.dk> | 2005-05-01 11:59:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:59:14 -0400 |
commit | 7ed20e1ad521b5f5df61bf6559ae60738e393741 (patch) | |
tree | 90931724e45eaedb3445314e8b94e78253642395 /kernel/signal.c | |
parent | e5bdd883a189243541e7a132385580703b049102 (diff) |
[PATCH] convert that currently tests _NSIG directly to use valid_signal()
Convert most of the current code that uses _NSIG directly to instead use
valid_signal(). This avoids gcc -W warnings and off-by-one errors.
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index e6567d7f2b62..8f3debc77c5b 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/syscalls.h> | 23 | #include <linux/syscalls.h> |
24 | #include <linux/ptrace.h> | 24 | #include <linux/ptrace.h> |
25 | #include <linux/posix-timers.h> | 25 | #include <linux/posix-timers.h> |
26 | #include <linux/signal.h> | ||
26 | #include <asm/param.h> | 27 | #include <asm/param.h> |
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
28 | #include <asm/unistd.h> | 29 | #include <asm/unistd.h> |
@@ -646,7 +647,7 @@ static int check_kill_permission(int sig, struct siginfo *info, | |||
646 | struct task_struct *t) | 647 | struct task_struct *t) |
647 | { | 648 | { |
648 | int error = -EINVAL; | 649 | int error = -EINVAL; |
649 | if (sig < 0 || sig > _NSIG) | 650 | if (!valid_signal(sig)) |
650 | return error; | 651 | return error; |
651 | error = -EPERM; | 652 | error = -EPERM; |
652 | if ((!info || ((unsigned long)info != 1 && | 653 | if ((!info || ((unsigned long)info != 1 && |
@@ -1245,7 +1246,7 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p) | |||
1245 | * Make sure legacy kernel users don't send in bad values | 1246 | * Make sure legacy kernel users don't send in bad values |
1246 | * (normal paths check this in check_kill_permission). | 1247 | * (normal paths check this in check_kill_permission). |
1247 | */ | 1248 | */ |
1248 | if (sig < 0 || sig > _NSIG) | 1249 | if (!valid_signal(sig)) |
1249 | return -EINVAL; | 1250 | return -EINVAL; |
1250 | 1251 | ||
1251 | /* | 1252 | /* |
@@ -1520,7 +1521,7 @@ void do_notify_parent(struct task_struct *tsk, int sig) | |||
1520 | if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) | 1521 | if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) |
1521 | sig = 0; | 1522 | sig = 0; |
1522 | } | 1523 | } |
1523 | if (sig > 0 && sig <= _NSIG) | 1524 | if (valid_signal(sig) && sig > 0) |
1524 | __group_send_sig_info(sig, &info, tsk->parent); | 1525 | __group_send_sig_info(sig, &info, tsk->parent); |
1525 | __wake_up_parent(tsk, tsk->parent); | 1526 | __wake_up_parent(tsk, tsk->parent); |
1526 | spin_unlock_irqrestore(&psig->siglock, flags); | 1527 | spin_unlock_irqrestore(&psig->siglock, flags); |
@@ -2364,7 +2365,7 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact) | |||
2364 | { | 2365 | { |
2365 | struct k_sigaction *k; | 2366 | struct k_sigaction *k; |
2366 | 2367 | ||
2367 | if (sig < 1 || sig > _NSIG || (act && sig_kernel_only(sig))) | 2368 | if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig))) |
2368 | return -EINVAL; | 2369 | return -EINVAL; |
2369 | 2370 | ||
2370 | k = ¤t->sighand->action[sig-1]; | 2371 | k = ¤t->sighand->action[sig-1]; |