From: Corey Minyard I was having a problem with signals with POSIX timers, and it turns out that the value of SIGRTMAX is incorrect. Remember that there is no signal 0, so the signals should go from 1-_NSIG. However, SIGRTMAX is defined as (_NSIG-1) in all architectures. The following patch fixes this. This define is only used in drivers/usb/core/devio.c and kernel/posix-timers.c, and both are incorrect without this fix. There's also no check for zero in posix-timers.c, that fix is part of the diff. Also, shouldn't do_sigaction() use this value instead of _NSIG? It's not a big deal, but some architectures have different values for _NSIG and SIGRTMAX. 25-akpm/include/asm-alpha/signal.h | 2 +- 25-akpm/include/asm-arm/signal.h | 2 +- 25-akpm/include/asm-arm26/signal.h | 2 +- 25-akpm/include/asm-cris/signal.h | 2 +- 25-akpm/include/asm-h8300/signal.h | 2 +- 25-akpm/include/asm-i386/signal.h | 2 +- 25-akpm/include/asm-ia64/signal.h | 2 +- 25-akpm/include/asm-m68k/signal.h | 2 +- 25-akpm/include/asm-m68knommu/signal.h | 2 +- 25-akpm/include/asm-mips/signal.h | 2 +- 25-akpm/include/asm-parisc/signal.h | 2 +- 25-akpm/include/asm-ppc/signal.h | 2 +- 25-akpm/include/asm-ppc64/signal.h | 2 +- 25-akpm/include/asm-s390/signal.h | 2 +- 25-akpm/include/asm-sh/signal.h | 2 +- 25-akpm/include/asm-sparc/signal.h | 2 +- 25-akpm/include/asm-sparc64/signal.h | 2 +- 25-akpm/include/asm-v850/signal.h | 2 +- 25-akpm/include/asm-x86_64/signal.h | 2 +- 25-akpm/kernel/posix-timers.c | 1 + 20 files changed, 20 insertions(+), 19 deletions(-) diff -puN include/asm-alpha/signal.h~SIGRTMAX-fix include/asm-alpha/signal.h --- 25/include/asm-alpha/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-alpha/signal.h Wed Sep 17 13:25:02 2003 @@ -71,7 +71,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-arm26/signal.h~SIGRTMAX-fix include/asm-arm26/signal.h --- 25/include/asm-arm26/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-arm26/signal.h Wed Sep 17 13:25:02 2003 @@ -68,7 +68,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG #define SIGSWI 32 diff -puN include/asm-arm/signal.h~SIGRTMAX-fix include/asm-arm/signal.h --- 25/include/asm-arm/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-arm/signal.h Wed Sep 17 13:25:02 2003 @@ -68,7 +68,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG #define SIGSWI 32 diff -puN include/asm-cris/signal.h~SIGRTMAX-fix include/asm-cris/signal.h --- 25/include/asm-cris/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-cris/signal.h Wed Sep 17 13:25:02 2003 @@ -68,7 +68,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-h8300/signal.h~SIGRTMAX-fix include/asm-h8300/signal.h --- 25/include/asm-h8300/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-h8300/signal.h Wed Sep 17 13:25:02 2003 @@ -68,7 +68,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-i386/signal.h~SIGRTMAX-fix include/asm-i386/signal.h --- 25/include/asm-i386/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-i386/signal.h Wed Sep 17 13:25:02 2003 @@ -70,7 +70,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-ia64/signal.h~SIGRTMAX-fix include/asm-ia64/signal.h --- 25/include/asm-ia64/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-ia64/signal.h Wed Sep 17 13:25:02 2003 @@ -50,7 +50,7 @@ /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-m68knommu/signal.h~SIGRTMAX-fix include/asm-m68knommu/signal.h --- 25/include/asm-m68knommu/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-m68knommu/signal.h Wed Sep 17 13:25:02 2003 @@ -68,7 +68,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-m68k/signal.h~SIGRTMAX-fix include/asm-m68k/signal.h --- 25/include/asm-m68k/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-m68k/signal.h Wed Sep 17 13:25:02 2003 @@ -68,7 +68,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-mips/signal.h~SIGRTMAX-fix include/asm-mips/signal.h --- 25/include/asm-mips/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-mips/signal.h Wed Sep 17 13:25:02 2003 @@ -59,7 +59,7 @@ typedef unsigned long old_sigset_t; /* /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-parisc/signal.h~SIGRTMAX-fix include/asm-parisc/signal.h --- 25/include/asm-parisc/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-parisc/signal.h Wed Sep 17 13:25:02 2003 @@ -42,7 +42,7 @@ /* These should not be considered constants from userland. */ #define SIGRTMIN 37 -#define SIGRTMAX (_NSIG-1) /* it's 44 under HP/UX */ +#define SIGRTMAX _NSIG /* it's 44 under HP/UX */ /* * SA_FLAGS values: diff -puN include/asm-ppc64/signal.h~SIGRTMAX-fix include/asm-ppc64/signal.h --- 25/include/asm-ppc64/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-ppc64/signal.h Wed Sep 17 13:25:02 2003 @@ -57,7 +57,7 @@ typedef struct { /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-ppc/signal.h~SIGRTMAX-fix include/asm-ppc/signal.h --- 25/include/asm-ppc/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-ppc/signal.h Wed Sep 17 13:25:02 2003 @@ -61,7 +61,7 @@ typedef struct { /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-s390/signal.h~SIGRTMAX-fix include/asm-s390/signal.h --- 25/include/asm-s390/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-s390/signal.h Wed Sep 17 13:25:02 2003 @@ -78,7 +78,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-sh/signal.h~SIGRTMAX-fix include/asm-sh/signal.h --- 25/include/asm-sh/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-sh/signal.h Wed Sep 17 13:25:02 2003 @@ -57,7 +57,7 @@ typedef struct { /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-sparc64/signal.h~SIGRTMAX-fix include/asm-sparc64/signal.h --- 25/include/asm-sparc64/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-sparc64/signal.h Wed Sep 17 13:25:02 2003 @@ -89,7 +89,7 @@ #define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW) #define SIGRTMIN 32 -#define SIGRTMAX (__NEW_NSIG - 1) +#define SIGRTMAX __NEW_NSIG #if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) #define _NSIG __NEW_NSIG diff -puN include/asm-sparc/signal.h~SIGRTMAX-fix include/asm-sparc/signal.h --- 25/include/asm-sparc/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-sparc/signal.h Wed Sep 17 13:25:02 2003 @@ -89,7 +89,7 @@ #define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW) #define SIGRTMIN 32 -#define SIGRTMAX (__NEW_NSIG - 1) +#define SIGRTMAX __NEW_NSIG #if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__) #define _NSIG __NEW_NSIG diff -puN include/asm-v850/signal.h~SIGRTMAX-fix include/asm-v850/signal.h --- 25/include/asm-v850/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-v850/signal.h Wed Sep 17 13:25:02 2003 @@ -71,7 +71,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN include/asm-x86_64/signal.h~SIGRTMAX-fix include/asm-x86_64/signal.h --- 25/include/asm-x86_64/signal.h~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/include/asm-x86_64/signal.h Wed Sep 17 13:25:02 2003 @@ -77,7 +77,7 @@ typedef unsigned long sigset_t; /* These should not be considered constants from userland. */ #define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) +#define SIGRTMAX _NSIG /* * SA_FLAGS values: diff -puN kernel/posix-timers.c~SIGRTMAX-fix kernel/posix-timers.c --- 25/kernel/posix-timers.c~SIGRTMAX-fix Wed Sep 17 13:25:02 2003 +++ 25-akpm/kernel/posix-timers.c Wed Sep 17 13:25:02 2003 @@ -344,6 +344,7 @@ static inline struct task_struct * good_ return NULL; if ((event->sigev_notify & ~SIGEV_NONE & MIPS_SIGEV) && + event->sigev_signo && ((unsigned) (event->sigev_signo > SIGRTMAX))) return NULL; _