xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Dario Faggioli <dario.faggioli@citrix.com>, xen-devel@lists.xen.org
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com
Subject: Re: [PATCH v2] libxl: memory size in kb requires 64 bit variable
Date: Thu, 28 Jul 2016 14:48:49 +0200	[thread overview]
Message-ID: <4e4e22f7-c33e-f996-bf6c-e6b0658989a4@suse.com> (raw)
In-Reply-To: <1469707903.5501.3.camel@citrix.com>

On 28/07/16 14:11, Dario Faggioli wrote:
> On Fri, 2016-07-22 at 08:53 +0200, Juergen Gross wrote:
>> libxl_set_memory_target() and several other interface functions of
>> libxl use a 32 bit sized parameter for a memory size value in kBytes.
>> This limits the maximum size to be passed in such a parameter
>> depending on signedness of the parameter to 2TB or 4TB.
>>
>> Correct this by using 64 bit types.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>
> Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
> 
> Entirely out of folklore, it seems to me that this function...
> 
>> @@ -5057,8 +5057,28 @@ out:
>>      return rc;
>>  }
>>  
>> +static int libxl__memkb_32to64(libxl_ctx *ctx, int rc,
>> +                               uint64_t val64, uint32_t *ptr32)
>> +{
>> +    GC_INIT(ctx);
>> +
>> +    if (rc)
>> +        goto out;
>> +
>> +    *ptr32 = val64;
>> +    if (*ptr32 == val64)
>> +        goto out;
>> +
>> +    LOGE(ERROR, "memory size %"PRIu64" too large for 32 bit
>> value\n", val64);
>> +    rc = ERROR_FAIL;
>> +
>> +out:
>> +    GC_FREE;
>> +    return rc;
>> +}
>> +
> ...does more 64to32 then 32to64, but maybe that's me, and, anyway, it's
> certainly not a big deal.

Hmm, yes, I can see your point.

Will do V3. Only doing the rename, can I keep your Reviewed-by: ?


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-07-28 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-22  6:53 [PATCH v2] libxl: memory size in kb requires 64 bit variable Juergen Gross
2016-07-28 12:11 ` Dario Faggioli
2016-07-28 12:48   ` Juergen Gross [this message]
2016-07-28 13:21     ` Dario Faggioli

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=4e4e22f7-c33e-f996-bf6c-e6b0658989a4@suse.com \
    --to=jgross@suse.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).