From: "Jan Beulich" Subject: Ping: [PATCH] domctl: don't truncate XEN_DOMCTL_max_mem requests Date: Mon, 04 May 2015 08:49:46 +0100 Message-ID: <554740BA020000780007625F@mail.emea.novell.com> References: <5537A8700200007800074B0B@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YpB8S-0006n4-ND for xen-devel@lists.xenproject.org; Mon, 04 May 2015 07:49:52 +0000 In-Reply-To: <5537A8700200007800074B0B@mail.emea.novell.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell , Ian Jackson , Keir Fraser , Tim Deegan Cc: xen-devel List-Id: xen-devel@lists.xenproject.org While I got a review from Andrew, I'm still waiting for an ack (or nak). Thanks, Jan >>> On 22.04.15 at 13:56, wrote: > Instead saturate the value if the input can't be represented in the > respective struct domain field. > > Signed-off-by: Jan Beulich > > --- a/xen/common/domctl.c > +++ b/xen/common/domctl.c > @@ -944,7 +944,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe > > case XEN_DOMCTL_max_mem: > { > - unsigned long new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10); > + uint64_t new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT - 10); > > spin_lock(&d->page_alloc_lock); > /* > @@ -952,7 +952,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe > * that the domain will now be allowed to "ratchet" down to new_max. In > * the meantime, while tot > max, all new allocations are disallowed. > */ > - d->max_pages = new_max; > + d->max_pages = min(new_max, (uint64_t)(typeof(d->max_pages))-1); > spin_unlock(&d->page_alloc_lock); > break; > }