[libvirt] [PATCH] Fix cast error in virsh-host.c

Roman Bogorodskiy bogorodskiy at gmail.com
Thu Jun 19 14:42:35 UTC 2014


Build with clang fails on virsh-host.c:

virsh-host.c:323:53: error: cast from 'unsigned int *' to 'unsigned long long *' increases required alignment from 4 to 8 [-Werror,-Wcast-align]
        if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *) pagesize,

Fix that by casting pagesize to void* first.
---
 tools/virsh-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2d6cb00..05e3fea 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -320,7 +320,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
         }
 
         pagesize = vshMalloc(ctl, sizeof(*pagesize));
-        if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *) pagesize,
+        if (vshCommandOptScaledInt(cmd, "pagesize", (unsigned long long *)(void  *) pagesize,
                                    1, UINT_MAX) < 0) {
             vshError(ctl, "%s", _("page size has to be a number"));
             goto cleanup;
-- 
1.9.0




More information about the libvir-list mailing list