Re: [chrony-dev] [GIT] chrony/chrony.git branch, master, updated. 2.2.1-90-g7cc432f

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Sat, Jan 23, 2016 at 08:56:23AM +1300, Bryan Christianson wrote:
> Many compiler warnings from this patch on OS X

> gcc -O2 -g -Wmissing-prototypes -Wall -pthread  -c pktlength.c
> pktlength.c:58:3: warning: implicit conversion from 'unsigned long' to
>       'uint16_t' (aka 'unsigned short') changes value from 18446744073709551584
>       to 65504 [-Wconstant-conversion]
>   REQ_LENGTH_ENTRY(online, null),               /* ONLINE */
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> pktlength.c:44:5: note: expanded from macro 'REQ_LENGTH_ENTRY'
>     PADDING_LENGTH(data.request_data_field.EOR, data.reply_data_field.EOR) }
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> pktlength.c:40:3: note: expanded from macro 'PADDING_LENGTH'
>   PADDING_LENGTH_(offsetof(CMD_Request, request_data), offsetof(CMD_Reply, reply_data))
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> pktlength.c:37:55: note: expanded from macro 'PADDING_LENGTH_'
>   ((request_length) < (reply_length) ? (reply_length) - (request_length) : 0)

Hm, the result is the third operand for this case, so I'm not sure why it
complains about overflow in the conversion of the second operand.

Can you please try it with this patch?

--- a/pktlength.c
+++ b/pktlength.c  
@@ -34,7 +34,7 @@
 #include "pktlength.h"  

 #define PADDING_LENGTH_(request_length, reply_length) \  
-  ((request_length) < (reply_length) ? (reply_length) - (request_length) : 0)
+  (uint16_t)((request_length) < (reply_length) ? (reply_length) - (request_length) : 0)  

 #define PADDING_LENGTH(request_data, reply_data) \  
   PADDING_LENGTH_(offsetof(CMD_Request, request_data), offsetof(CMD_Reply, reply_data))

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/