From: Tom Rini Date: Mon, 29 Jul 2019 21:23:40 -0400 Subject: [U-Boot] [PATCH 1/1] lib: uuid: alignment error in gen_rand_uuid() In-Reply-To: <20190714213150.4713-1-xypron.glpk@gmx.de> References: <20190714213150.4713-1-xypron.glpk@gmx.de> Message-ID: <20190730012340.GG16910@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On Sun, Jul 14, 2019 at 11:31:50PM +0200, Heinrich Schuchardt wrote: > Packed structures like struct uuid are not aligned. GCC 9.1 therefore > throws an error when trying to compile gen_rand_uuid(). > > lib/uuid.c: In function ‘gen_rand_uuid’: > lib/uuid.c:244:2: error: converting a packed ‘struct uuid’ pointer > (alignment 1) to a ‘unsigned int’ pointer (alignment 4) may result in > an unaligned pointer value [-Werror=address-of-packed-member] > 244 | unsigned int *ptr = (unsigned int *)&uuid; > | ^~~~~~~~ > > Generate the uuid in a properly aligned buffer. > > The byte order of a random number should not matter. Do not call > cpu_to_be32() to change the byte order. > > Reported-by: Ramon Fried > Signed-off-by: Heinrich Schuchardt Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: