diff mbox

[13/16] kpartx: fix strict aliasing warning

Message ID 1386744190-1295-14-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Benjamin Marzinski Dec. 11, 2013, 6:43 a.m. UTC
Compiling with strict aliasing throws warnings about aliasing
volume_label_t to an array of unsigned ints. Adding __may_alias__
lets it know that we meant to do this.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 kpartx/dasd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/kpartx/dasd.c b/kpartx/dasd.c
index dcdf678..1fcf778 100644
--- a/kpartx/dasd.c
+++ b/kpartx/dasd.c
@@ -46,6 +46,8 @@  unsigned long long sectors512(unsigned long long sectors, int blocksize)
 	return sectors * (blocksize >> 9);
 }
 
+typedef unsigned int __attribute__((__may_alias__)) label_ints_t;
+
 /*
  */
 int 
@@ -169,7 +171,7 @@  read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
 		/*
 		 * VM style CMS1 labeled disk
 		 */
-		unsigned int *label = (unsigned int *) &vlabel;
+		label_ints_t *label = (label_ints_t *) &vlabel;
 
 		blocksize = label[4];
 		if (label[14] != 0) {