[PATCH v3] Fix misaligned accesses to fields in HEADER struct defined in <arpa/nameser_compat.h>

John David Anglin dave.anglin@bell.net
Sat Jun 25 15:32:00 GMT 2016


On 2016-06-22, at 6:51 AM, Mike Frysinger wrote:

> On 17 Jun 2016 18:52, John David Anglin wrote:
>> --- a/resolv/res_mkquery.c
>> +++ b/resolv/res_mkquery.c
>> @@ -83,6 +83,8 @@
>> # define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; }
>> #endif
>> 
>> +typedef HEADER __attribute__ ((aligned(1))) HEADER1;
> 
> could do with a comment above it explaining what this is all about
> 
> should be __aligned__
> 
> bike shed: maybe "UHEADER" is better ?
> 
> code-wise, should this file always be using this variant ?  would
> it be too ugly to do:
> 	typedef ...
> 	#define HEADER HEADER1

The attached patch implements the above suggestions except for res_query.c where
is directly substituted as necessary.

Tested on hppa-unknown-linux-gnu with a trunk build and check.

Please install if okay.

Dave
--
John David Anglin	dave.anglin@bell.net


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: submitted-header-v3.diff.txt
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160625/67ddd0b7/attachment.txt>


More information about the Libc-alpha mailing list