forked from mirrors/linux
		
	Make sure the value in abs() does not get truncated if it is greater than 2^32
abs() will truncate the input if is it outside the 2^32 range. Fix that by assuming `long' input. This might generate worse code in the common case. Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									d7d7561c90
								
							
						
					
					
						commit
						a49c59c042
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -146,7 +146,7 @@ extern int _cond_resched(void);
 | 
				
			||||||
#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
 | 
					#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define abs(x) ({				\
 | 
					#define abs(x) ({				\
 | 
				
			||||||
		int __x = (x);			\
 | 
							long __x = (x);			\
 | 
				
			||||||
		(__x < 0) ? -__x : __x;		\
 | 
							(__x < 0) ? -__x : __x;		\
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue