]> sourceware.org Git - lvm2.git/commitdiff
dm: alloc always 8byte aligned
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 11 Feb 2016 11:00:28 +0000 (12:00 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 11 Feb 2016 17:35:05 +0000 (18:35 +0100)
Fixing regression caused by 197b5e6dc7dd8ec161ebe43c97fd2ac8384b3433.
So the 'TODO' part now finally know the answer - there is 'sparc64'
architecture which imposes limitation to read 64b words only through
64b aligned address.

Since we never could know how is the user going to use the returned
pointer and the userusually expects it's aligned on the highest CPU
required alignement, preserve it also for char*.

Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809685
Reported-by: Anatoly Pugachev <matorola@gmail.com>
WHATS_NEW_DM
libdm/mm/pool.c

index f54868f802777913ee55c41df8d349d2a29909bd..693667bbfed6e411df53aba4b39213475f377d93 100644 (file)
@@ -1,5 +1,6 @@
 Version 1.02.116 - 
 ====================================
+  Use fully aligned allocations for dm_pool_strdup/strndup() (1.02.64).
   Fix thin-pool table parameter feature order to match kernel output.
 
 Version 1.02.115 - 25th January 2016
index ec6f1b859ad34f91e73299411cfcf6832e0dc82a..c1cb61e2929ee7ddd04a2baaaf5251e510a02688 100644 (file)
@@ -48,17 +48,18 @@ static size_t pagesize_mask = 0;
 
 char *dm_pool_strdup(struct dm_pool *p, const char *str)
 {
-       char *ret = dm_pool_alloc_aligned(p, strlen(str) + 1, 2);
+       size_t len = strlen(str) + 1;
+       char *ret = dm_pool_alloc(p, len);
 
        if (ret)
-               strcpy(ret, str);
+               memcpy(ret, str, len);
 
        return ret;
 }
 
 char *dm_pool_strndup(struct dm_pool *p, const char *str, size_t n)
 {
-       char *ret = dm_pool_alloc_aligned(p, n + 1, 2);
+       char *ret = dm_pool_alloc(p, n + 1);
 
        if (ret) {
                strncpy(ret, str, n);
This page took 0.182983 seconds and 5 git commands to generate.