From: Khem Raj Subject: [PATCH kvmtool] Avoid pointers for address of packed members Date: Tue, 21 Mar 2017 23:38:36 -0700 Message-ID: <20170322063836.5178-1-raj.khem@gmail.com> Cc: Khem Raj To: kvm@vger.kernel.org Return-path: Received: from mail-pg0-f66.google.com ([74.125.83.66]:35736 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751288AbdCVGiz (ORCPT ); Wed, 22 Mar 2017 02:38:55 -0400 Received: by mail-pg0-f66.google.com with SMTP id g2so28779642pge.2 for ; Tue, 21 Mar 2017 23:38:46 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: Fixes Clang warning due to -Waddress-of-packed-member virtio/blk.c:161:37: error: taking address of packed member 'geometry' of class or structure 'virtio_blk_config' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] struct virtio_blk_geometry *geo = &conf->geometry; Signed-off-by: Khem Raj --- virtio/blk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/virtio/blk.c b/virtio/blk.c index c485e4f..1f7365d 100644 --- a/virtio/blk.c +++ b/virtio/blk.c @@ -158,7 +158,6 @@ static void set_guest_features(struct kvm *kvm, void *dev, u32 features) { struct blk_dev *bdev = dev; struct virtio_blk_config *conf = &bdev->blk_config; - struct virtio_blk_geometry *geo = &conf->geometry; bdev->features = features; @@ -167,7 +166,7 @@ static void set_guest_features(struct kvm *kvm, void *dev, u32 features) conf->seg_max = virtio_host_to_guest_u32(&bdev->vdev, conf->seg_max); /* Geometry */ - geo->cylinders = virtio_host_to_guest_u16(&bdev->vdev, geo->cylinders); + conf->geometry.cylinders = virtio_host_to_guest_u16(&bdev->vdev, conf->geometry.cylinders); conf->blk_size = virtio_host_to_guest_u32(&bdev->vdev, conf->blk_size); conf->min_io_size = virtio_host_to_guest_u16(&bdev->vdev, conf->min_io_size); -- 2.12.0