Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebba5f9f authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds
Browse files

[PATCH] consistently use MAX_ERRNO in __syscall_return



Consistently use MAX_ERRNO when checking for errors in __syscall_return().

[ralf@linux-mips.org: build fix]
Signed-off-by: default avatarRandy Dunlap <rdunlap@xenotime.net>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bd8e39f9
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -377,6 +377,7 @@
#endif
#endif


#ifdef __KERNEL__
#ifdef __KERNEL__
#include <linux/err.h>
#include <linux/linkage.h>
#include <linux/linkage.h>


#define __sys2(x) #x
#define __sys2(x) #x
@@ -396,7 +397,7 @@


#define __syscall_return(type, res)					\
#define __syscall_return(type, res)					\
do {									\
do {									\
	if ((unsigned long)(res) >= (unsigned long)(-129)) {		\
	if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) {	\
		errno = -(res);						\
		errno = -(res);						\
		res = -1;						\
		res = -1;						\
	}								\
	}								\
+2 −1
Original line number Original line Diff line number Diff line
@@ -311,6 +311,7 @@
#define __ARM_NR_usr26			(__ARM_NR_BASE+3)
#define __ARM_NR_usr26			(__ARM_NR_BASE+3)


#ifdef __KERNEL__
#ifdef __KERNEL__
#include <linux/err.h>
#include <linux/linkage.h>
#include <linux/linkage.h>


#define __sys2(x) #x
#define __sys2(x) #x
@@ -322,7 +323,7 @@


#define __syscall_return(type, res)					\
#define __syscall_return(type, res)					\
do {									\
do {									\
	if ((unsigned long)(res) >= (unsigned long)(-125)) {		\
	if ((unsigned long)(res) >= (unsigned long)-MAX_ERRNO) {	\
		errno = -(res);						\
		errno = -(res);						\
		res = -1;						\
		res = -1;						\
	}								\
	}								\
+2 −1
Original line number Original line Diff line number Diff line
@@ -320,6 +320,7 @@
#ifdef __KERNEL__
#ifdef __KERNEL__


#define NR_syscalls 310
#define NR_syscalls 310
#include <linux/err.h>


/*
/*
 * process the return value of a syscall, consigning it to one of two possible fates
 * process the return value of a syscall, consigning it to one of two possible fates
@@ -329,7 +330,7 @@
#define __syscall_return(type, res)					\
#define __syscall_return(type, res)					\
do {									\
do {									\
        unsigned long __sr2 = (res);					\
        unsigned long __sr2 = (res);					\
	if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) {	\
	if (__builtin_expect(__sr2 >= (unsigned long)(-MAX_ERRNO), 0)) { \
		errno = (-__sr2);					\
		errno = (-__sr2);					\
		__sr2 = ~0UL;						\
		__sr2 = ~0UL;						\
	}								\
	}								\
+3 −3
Original line number Original line Diff line number Diff line
@@ -295,14 +295,14 @@
#ifdef __KERNEL__
#ifdef __KERNEL__


#define NR_syscalls 289
#define NR_syscalls 289
#include <linux/err.h>



/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
/* user-visible error numbers are in the range -1 - -122: see
   <asm-m68k/errno.h> */
   <asm-m68k/errno.h> */


#define __syscall_return(type, res) \
#define __syscall_return(type, res) \
do { \
do { \
	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
	if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
	/* avoid using res which is declared to be in register d0; \
	/* avoid using res which is declared to be in register d0; \
	   errno might expand to a function call and clobber it.  */ \
	   errno might expand to a function call and clobber it.  */ \
		int __err = -(res); \
		int __err = -(res); \
+3 −2
Original line number Original line Diff line number Diff line
@@ -328,14 +328,15 @@
#ifdef __KERNEL__
#ifdef __KERNEL__


#define NR_syscalls 319
#define NR_syscalls 319
#include <linux/err.h>


/*
/*
 * user-visible error numbers are in the range -1 - -128: see
 * user-visible error numbers are in the range -1 - -MAX_ERRNO: see
 * <asm-i386/errno.h>
 * <asm-i386/errno.h>
 */
 */
#define __syscall_return(type, res) \
#define __syscall_return(type, res) \
do { \
do { \
	if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \
	if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
		errno = -(res); \
		errno = -(res); \
		res = -1; \
		res = -1; \
	} \
	} \
Loading