[PATCH] SAP: Make PADDING4 macro a bit more robust

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

 



Bitwise operations are done before arithmetic operations and this might
cause undesired results if macro is called with parameter of form x+y.
---
 sap/server.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sap/server.c b/sap/server.c
index b8aa8a5..b5abd70 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -49,7 +49,7 @@
 #define SAP_UUID		"0000112D-0000-1000-8000-00805F9B34FB"
 #define SAP_SERVER_CHANNEL	8
 
-#define PADDING4(x) ((4 - (x & 0x03)) & 0x03)
+#define PADDING4(x) ((4 - ((x) & 0x03)) & 0x03)
 #define PARAMETER_SIZE(x) (sizeof(struct sap_parameter) + x + PADDING4(x))
 
 #define SAP_NO_REQ 0xFF
-- 
on behalf of ST-Ericsson

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux