From patchwork Wed Mar 22 06:38:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 9638153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E93C8601E9 for ; Wed, 22 Mar 2017 06:42:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF7E627CF9 for ; Wed, 22 Mar 2017 06:42:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2A4C272F9; Wed, 22 Mar 2017 06:42:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 717CB272F9 for ; Wed, 22 Mar 2017 06:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758738AbdCVGkL (ORCPT ); Wed, 22 Mar 2017 02:40:11 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=T1PAVfEIiHaNVQWwJa4nOC9ioytf7TLyVEtZd2oRGvI=; b=JCHf1E6tgXTrN50rWYPDpU56vGQGdyxoVuiIYZVUSNaugZuvUVzu4Ur3hieQ/4Bt2V T8XnqaKZYeCq+GXTDJ6CPL/+4aZKew4SooNp4QcziInNtcqSqSTFSFs5Qtparwj2GXtw 3b9XH8DR0r+S1AGKV0ijrcELkAGtkD1o9NlyzX+uQ6bYUOi3PJUnsJdTIQHHqDQR5Ldy tCvyo2sXurBzNUoxhTEqguFZ4Ga5jrUvt8tYZ3xxx//RAm0lJ0I4ms+TL3QrCysk7Wgl JHGERb6ZGCktarrk0sO+slW9ySMzYxfKGvDvQ8Fjz6iAfuBGU2Rfm4NxvRu2iD8xVqys k/qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=T1PAVfEIiHaNVQWwJa4nOC9ioytf7TLyVEtZd2oRGvI=; b=AGqeE2YM1yLSAsDLwU9Y02rvxNX191jJXzpbbVvy1TyLX0vd/MK/xOW/vM0CypNd4G 1IRbgi1zSfKrErBH6e3yNW1/5AjnmXSoAIdYxpLaFk3UyT9H56K4l4U0xXPjnI7F4jxh vqurlBiFbIllLSA3qHOgZxKjIb+729gmGPKc2N1iqXNfzVLo5LKWZ7bKr2VR8ZiQBznO quCSxZwqjNrY7sEcnhRifYaNY2FBBGhF01Zrp4wo/MeadHUjEjpqUWJtW7LoN0QuMK2M qcygQwbE4NjxRJd7Fk3o1ewrPuawdltJPtBWZKDYhl0JQNR3ol8HsDhLQySboKfNuNKp za5g== X-Gm-Message-State: AFeK/H2gzqMCP6HmVuS+4ltm7qlFSoVIk9DgEr1CojXwgVrD3LldX6+DucQNThqI1zRkpw== X-Received: by 10.84.231.206 with SMTP id g14mr24891814pln.13.1490164726162; Tue, 21 Mar 2017 23:38:46 -0700 (PDT) Received: from localhost.localdomain (c-76-102-32-192.hsd1.ca.comcast.net. [76.102.32.192]) by smtp.gmail.com with ESMTPSA id n8sm1343383pgd.5.2017.03.21.23.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 23:38:44 -0700 (PDT) From: Khem Raj To: kvm@vger.kernel.org Cc: 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> X-Mailer: git-send-email 2.12.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);