qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Farhan Ali <alifm@linux.ibm.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, Richard Henderson <rth@twiddle.net>,
	Cornelia Huck <cohuck@redhat.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Max Filippov <jcmvbkbc@gmail.com>,
	Eric Farman <farman@linux.ibm.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Riku Voipio <riku.voipio@iki.fi>,
	Alex Williamson <alex.williamson@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Thomas Huth <thuth@redhat.com>,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [PATCH 13/14] hw/s390x/ipl: avoid taking address of fields in packed struct
Date: Tue, 2 Apr 2019 10:11:08 -0400	[thread overview]
Message-ID: <80307b7b-3ca2-d91f-3411-0825d02f1edd@linux.ibm.com> (raw)
In-Reply-To: <20190329111104.17223-14-berrange@redhat.com>



On 03/29/2019 07:11 AM, Daniel P. Berrangé wrote:
> Compiling with GCC 9 complains
> 
> hw/s390x/ipl.c: In function ‘s390_ipl_set_boot_menu’:
> hw/s390x/ipl.c:256:25: warning: taking address of packed member of ‘struct QemuIplParameters’ may result in an unaligned pointer value [-Waddress-of-packed-member]
>    256 |     uint32_t *timeout = &ipl->qipl.boot_menu_timeout;
>        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> This local variable is only present to save a little bit of
> typing when setting the field later. Get rid of this to avoid
> the warning about unaligned accesses.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   hw/s390x/ipl.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 896888bf8f..51b272e190 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -252,8 +252,6 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl)
>   {
>       QemuOptsList *plist = qemu_find_opts("boot-opts");
>       QemuOpts *opts = QTAILQ_FIRST(&plist->head);
> -    uint8_t *flags = &ipl->qipl.qipl_flags;
> -    uint32_t *timeout = &ipl->qipl.boot_menu_timeout;
>       const char *tmp;
>       unsigned long splash_time = 0;
>   
> @@ -269,7 +267,7 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl)
>       case S390_IPL_TYPE_CCW:
>           /* In the absence of -boot menu, use zipl parameters */
>           if (!qemu_opt_get(opts, "menu")) {
> -            *flags |= QIPL_FLAG_BM_OPTS_ZIPL;
> +            ipl->qipl.qipl_flags |= QIPL_FLAG_BM_OPTS_ZIPL;
>               return;
>           }
>           break;
> @@ -286,23 +284,23 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl)
>           return;
>       }
>   
> -    *flags |= QIPL_FLAG_BM_OPTS_CMD;
> +    ipl->qipl.qipl_flags |= QIPL_FLAG_BM_OPTS_CMD;
>   
>       tmp = qemu_opt_get(opts, "splash-time");
>   
>       if (tmp && qemu_strtoul(tmp, NULL, 10, &splash_time)) {
>           error_report("splash-time is invalid, forcing it to 0");
> -        *timeout = 0;
> +        ipl->qipl.boot_menu_timeout = 0;
>           return;
>       }
>   
>       if (splash_time > 0xffffffff) {
>           error_report("splash-time is too large, forcing it to max value");
> -        *timeout = 0xffffffff;
> +        ipl->qipl.boot_menu_timeout = 0xffffffff;
>           return;
>       }
>   
> -    *timeout = cpu_to_be32(splash_time);
> +    ipl->qipl.boot_menu_timeout = cpu_to_be32(splash_time);
>   }
>   
>   static CcwDevice *s390_get_ccw_device(DeviceState *dev_st)
> 

Reviewed-by: Farhan Ali <alifm@linux.ibm.com>

  parent reply	other threads:[~2019-04-02 14:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190329111104.17223-1-berrange@redhat.com>
     [not found] ` <20190329111104.17223-13-berrange@redhat.com>
2019-04-01 11:50   ` [Qemu-devel] [qemu-s390x] [PATCH 12/14] hw/s390/css: avoid taking address members in packed structs Halil Pasic
     [not found] ` <20190329111104.17223-14-berrange@redhat.com>
2019-04-02 14:11   ` Farhan Ali [this message]
     [not found] ` <20190329111104.17223-12-berrange@redhat.com>
2019-04-01 14:07   ` [Qemu-devel] [PATCH 11/14] hw/vfio/ccw: " Halil Pasic
2019-04-02 14:16   ` Farhan Ali
2019-04-02 16:00   ` Cornelia Huck
2019-04-02 16:05     ` Thomas Huth
2019-04-02 16:12       ` Cornelia Huck
2019-04-02 16:11     ` Daniel P. Berrangé
2019-04-03  9:33       ` Cornelia Huck
     [not found] ` <20190329111104.17223-9-berrange@redhat.com>
2019-04-12 12:24   ` [Qemu-devel] [PATCH 08/14] qxl: avoid unaligned pointer reads/writes Marc-André Lureau
2019-04-12 12:24     ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80307b7b-3ca2-d91f-3411-0825d02f1edd@linux.ibm.com \
    --to=alifm@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).