qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] smbios: fixed compiler warning on clang > 3.4
@ 2014-10-31  4:57 SeokYeon Hwang
  2014-11-03 16:16 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: SeokYeon Hwang @ 2014-10-31  4:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru, alex.williamson, SeokYeon Hwang

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++) {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] smbios: fixed compiler warning on clang > 3.4
  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
  2014-11-04  6:48   ` SeokYeon Hwang
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2014-11-03 16:16 UTC (permalink / raw)
  To: SeokYeon Hwang, qemu-devel; +Cc: armbru, alex.williamson

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] smbios: fixed compiler warning on clang > 3.4
  2014-11-03 16:16 ` Paolo Bonzini
@ 2014-11-04  6:48   ` SeokYeon Hwang
  0 siblings, 0 replies; 3+ messages in thread
From: SeokYeon Hwang @ 2014-11-04  6:48 UTC (permalink / raw)
  To: 'Paolo Bonzini', qemu-devel; +Cc: armbru, alex.williamson

> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> Bonzini
> Sent: Tuesday, November 04, 2014 1:16 AM
> To: SeokYeon Hwang; qemu-devel@nongnu.org
> Cc: armbru@redhat.com; alex.williamson@hp.com
> Subject: Re: [PATCH] smbios: fixed compiler warning on clang > 3.4
> 
> 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

You are right.
"smbios_build_type_17_table()" should take uint64_t.
I will post patch v2.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-04  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-11-04  6:48   ` SeokYeon Hwang

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).