[dmraid 3/4] Fix min/max macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These need parentheses around them.

In particular, in hpt37x.c, in 'to_cpu'
we have an expression:
   x + min(y,z)
which will become

 x + y > z ? y : z

which is not what is wanted.

From: dmraid-fdleak.patch
Signed-off-by: NeilBrown <neilb@xxxxxxx>

---
 lib/internal.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- dmraid-16.orig/lib/internal.h
+++ dmraid-16/lib/internal.h
@@ -50,8 +50,8 @@
 #define	u_int64_t	uint64_t
 #endif
 
-#define min(a, b) (a) < (b) ? (a) : (b)
-#define max(a, b) (a) > (b) ? (a) : (b)
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define max(a, b) ((a) > (b) ? (a) : (b))
 #define ARRAY_SIZE(a)   (sizeof(a) / sizeof(*a))
 #define ARRAY_END(a)   (a + ARRAY_SIZE(a))
 

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux