]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
use memcpy() to cope with possible misalignment
authornick black <nick.black@sprezzatech.com>
Sat, 7 Jul 2012 15:42:17 +0000 (11:42 -0400)
committernick black <nick.black@sprezzatech.com>
Sat, 7 Jul 2012 15:42:17 +0000 (11:42 -0400)
libblkid/src/topology/topology.c

index 5cde1876780d73c4e4060c9c889d80cabd892923..02476e502a33e5588a363833c67f246863bf4d15 100644 (file)
@@ -222,14 +222,13 @@ static int topology_set_value(blkid_probe pr, const char *name,
                return 0;       /* ignore zeros */
 
        if (chn->binary) {
-               unsigned long *v =
-                       (unsigned long *) (chn->data + structoff);
-               *v = data;
+               memcpy(chn->data + structoff, &data, sizeof(data));
                return 0;
        }
        return blkid_probe_sprintf_value(pr, name, "%llu", data);
 }
 
+
 /* the topology info is complete when we have at least "minimum_io_size" which
  * is provided by all blkid topology drivers */
 static int topology_is_complete(blkid_probe pr)