Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/iscsi fix strict aliasing issues.



details:   https://anonhg.NetBSD.org/src/rev/b40f165a4e48
branches:  trunk
changeset: 768462:b40f165a4e48
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 17 09:24:23 2011 +0000

description:
fix strict aliasing issues.

diffstat:

 external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c |  6 ++++--
 external/bsd/iscsi/initiator/Makefile                   |  7 +------
 2 files changed, 5 insertions(+), 8 deletions(-)

diffs (38 lines):

diff -r bfdc885c0ecb -r b40f165a4e48 external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c
--- a/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c   Wed Aug 17 09:20:14 2011 +0000
+++ b/external/bsd/iscsi/dist/src/initiator/iscsi-initiator.c   Wed Aug 17 09:24:23 2011 +0000
@@ -163,12 +163,14 @@
                iscsi_err(__FILE__, __LINE__, "READ_CAPACITY failed (status %#x)\n", args.status);
                return -1;
        }
-       *maxlba = ISCSI_NTOHL(*((uint32_t *) (data)));
-       *blocklen = ISCSI_NTOHL(*((uint32_t *) (data + 4)));
+       memcpy(maxlba, data, sizeof(*maxlba));
+       *maxlba = ISCSI_NTOHL(*maxlba);
        if (*maxlba == 0) {
                iscsi_err(__FILE__, __LINE__, "Device returned Maximum LBA of zero\n");
                return -1;
        }
+       memcpy(blocklen, data + 4, sizeof(*blocklen));
+       *blocklen = ISCSI_NTOHL(*blocklen);
        if (*blocklen % 2) {
                iscsi_err(__FILE__, __LINE__, "Device returned strange block len: %u\n", *blocklen);
                return -1;
diff -r bfdc885c0ecb -r b40f165a4e48 external/bsd/iscsi/initiator/Makefile
--- a/external/bsd/iscsi/initiator/Makefile     Wed Aug 17 09:20:14 2011 +0000
+++ b/external/bsd/iscsi/initiator/Makefile     Wed Aug 17 09:24:23 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2011/06/22 02:49:42 mrg Exp $
+# $NetBSD: Makefile,v 1.5 2011/08/17 09:24:23 christos Exp $
 
 .sinclude "${.CURDIR}/../Makefile.inc"
 
@@ -26,8 +26,3 @@
 .endif
 
 .include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.iscsi-initiator.c+=      -fno-strict-aliasing
-.endif



Home | Main Index | Thread Index | Old Index