nbd-client: Use correct macro parenthesization
authorEric Blake <eblake@redhat.com>
Mon, 18 Sep 2017 21:46:49 +0000 (16:46 -0500)
committerEric Blake <eblake@redhat.com>
Mon, 25 Sep 2017 13:21:25 +0000 (08:21 -0500)
If 'bs' is a complex expression, we were only casting the front half
rather than the full expression.  Luckily, none of the callers were
passing bad arguments, but it's better to be robust up front.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170918214649.17550-1-eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
block/nbd-client.c

index ee7f758e68c17db1cafe1051ff76237e69c710d3..cc05e73c2dd8efa9b28fcd99ed6fc456098e31ff 100644 (file)
@@ -31,8 +31,8 @@
 #include "qapi/error.h"
 #include "nbd-client.h"
 
-#define HANDLE_TO_INDEX(bs, handle) ((handle) ^ ((uint64_t)(intptr_t)bs))
-#define INDEX_TO_HANDLE(bs, index)  ((index)  ^ ((uint64_t)(intptr_t)bs))
+#define HANDLE_TO_INDEX(bs, handle) ((handle) ^ (uint64_t)(intptr_t)(bs))
+#define INDEX_TO_HANDLE(bs, index)  ((index)  ^ (uint64_t)(intptr_t)(bs))
 
 static void nbd_recv_coroutines_wake_all(NBDClientSession *s)
 {