[PATCH 13/16] kpartx: fix strict aliasing warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 kpartx/dasd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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) {
-- 
1.8.4.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux