Linux Device Mapper development
 help / color / mirror / Atom feed
From: neilb@suse.de
To: dm-devel@redhat.com
Subject: [dmraid 3/4] Fix min/max macros
Date: Thu, 17 Dec 2009 16:44:13 +1100	[thread overview]
Message-ID: <20091217054526.545361172@suse.de> (raw)
In-Reply-To: 20091217054410.410634166@suse.de

[-- Attachment #1: remove-min-max --]
[-- Type: text/plain, Size: 718 bytes --]

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@suse.de>

---
 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))
 

  parent reply	other threads:[~2009-12-17  5:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17  5:44 [dmraid 0/4] A few patches for dmraid neilb
2009-12-17  5:44 ` [dmraid 1/4] Parse "-cc" as required by man page neilb
2009-12-17 16:50   ` Heinz Mauelshagen
2009-12-17  5:44 ` [dmraid 2/4] Avoid fd leak in remove_device_partitions neilb
2009-12-17  5:44 ` neilb [this message]
2009-12-17  5:44 ` [dmraid 4/4] Fix two issues with installing shared libraries neilb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091217054526.545361172@suse.de \
    --to=neilb@suse.de \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox