lkml.org 
[lkml]   [2001]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject2.4.9 new min/max definitions are buggy
Date
Leaving aside the question of whether the new min/max functions are
sane or not, the 2.4.9 definitions are buggy. If type is a pointer
like char *, __x takes pointer type, __y takes base type, splat!

Index: 9.1/include/linux/kernel.h
--- 9.1/include/linux/kernel.h Tue, 21 Aug 2001 16:48:26 +1000 kaos (linux-2.4/g/b/11_kernel.h 1.1.1.5 644)
+++ 9.1(w)/include/linux/kernel.h Wed, 22 Aug 2001 13:33:28 +1000 kaos (linux-2.4/g/b/11_kernel.h 1.1.1.5 644)
@@ -113,9 +113,9 @@ static inline void console_verbose(void)
((unsigned char *)&addr)[0]

#define min(type,x,y) \
- ({ type __x = (x), __y = (y); __x < __y ? __x: __y; })
+ ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
#define max(type,x,y) \
- ({ type __x = (x), __y = (y); __x > __y ? __x: __y; })
+ ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })

#endif /* __KERNEL__ */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.022 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site