From: Dario Faggioli <dario.faggioli@citrix.com>
To: Juergen Gross <jgross@suse.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:11:43 +0200 [thread overview]
Message-ID: <1469707903.5501.3.camel@citrix.com> (raw)
In-Reply-To: <1469170393-9487-1-git-send-email-jgross@suse.com>
[-- Attachment #1.1: Type: text/plain, Size: 1531 bytes --]
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.
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-07-28 12:11 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 [this message]
2016-07-28 12:48 ` Juergen Gross
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=1469707903.5501.3.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jgross@suse.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).