qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: SeokYeon Hwang <syeon.hwang@samsung.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com, alex.williamson@hp.com
Subject: Re: [Qemu-devel] [PATCH] smbios: fixed compiler warning on clang > 3.4
Date: Mon, 03 Nov 2014 17:16:27 +0100	[thread overview]
Message-ID: <5457AA5B.50100@redhat.com> (raw)
In-Reply-To: <1414731433-13257-1-git-send-email-syeon.hwang@samsung.com>

On 31/10/2014 05:57, SeokYeon Hwang wrote:
> Explicit casting to 'ram_addr_t' in order to avoid "-Wconstant-conversion" on clang 3.4 or later.
> 
> Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
> ---
>  hw/i386/smbios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
> index e3fa1b2..ace9c44 100644
> --- a/hw/i386/smbios.c
> +++ b/hw/i386/smbios.c
> @@ -836,7 +836,7 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,
>          smbios_build_type_16_table(dimm_cnt);
>  
>          for (i = 0; i < dimm_cnt; i++) {
> -            smbios_build_type_17_table(i, GET_DIMM_SZ);
> +            smbios_build_type_17_table(i, (ram_addr_t)GET_DIMM_SZ);
>          }
>  
>          for (i = 0, instance = 0; i < e820_get_num_entries(); i++) {
> 

I'm not sure what the problem is.  Can you instead do something like:

         for (i = 0; i < dimm_cnt; i++) {
-            smbios_build_type_17_table(i, GET_DIMM_SZ);
+            uint64_t sz = (i < dimm_cnt - 1) ? MAX_DIMM_SZ : ram_size % MAX_DIMM_SZ;
+            smbios_build_type_17_table(i, sz);
         }

and change smbios_build_type_17_table to take simply a uint64_t?
Using ram_addr_t is probably wrong.

Paolo

  reply	other threads:[~2014-11-03 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31  4:57 [Qemu-devel] [PATCH] smbios: fixed compiler warning on clang > 3.4 SeokYeon Hwang
2014-11-03 16:16 ` Paolo Bonzini [this message]
2014-11-04  6:48   ` SeokYeon Hwang

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=5457AA5B.50100@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@hp.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=syeon.hwang@samsung.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).