From: Michael Brown Date: Mon, 27 Jul 2015 22:28:01 +0000 (+0100) Subject: [build] Fix strict-aliasing warning on older gcc versions X-Git-Tag: v1.20.1~760 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fae7a5310ad560f6afa3ab94ed349510443caf56;p=thirdparty%2Fipxe.git [build] Fix strict-aliasing warning on older gcc versions Reported-by: James A. Peltier Reported-by: Matthew Helton Signed-off-by: Michael Brown --- diff --git a/src/crypto/aes.c b/src/crypto/aes.c index 1605d2ee8..b9e206bfb 100644 --- a/src/crypto/aes.c +++ b/src/crypto/aes.c @@ -156,13 +156,17 @@ static struct aes_table aes_invmixcolumns; */ static inline __attribute__ (( always_inline )) uint32_t aes_entry_column ( const union aes_table_entry *entry, unsigned int column ) { - const uint8_t *first __attribute__ (( may_alias )); + const union { + uint8_t byte; + uint32_t column; + } __attribute__ (( may_alias )) *product; - /* Locate start of relevant four-byte subset */ - first = &entry->byte[ 4 - column ]; + /* Locate relevant four-byte subset */ + product = container_of ( &entry->byte[ 4 - column ], + typeof ( *product ), byte ); /* Extract this four-byte subset */ - return ( *( ( uint32_t * ) first ) ); + return product->column; } /**