From: "Jan Beulich" Subject: Re: [PATCH 1/4] common/sysctl: Don't leak status in SYSCTL_page_offline_op Date: Tue, 07 Jan 2014 11:33:17 +0000 Message-ID: <52CBF40D02000078001110CD@nat28.tlf.novell.com> References: <1388156253-14509-1-git-send-email-andrew.cooper3@citrix.com> <1388156253-14509-2-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1388156253-14509-2-git-send-email-andrew.cooper3@citrix.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: Andrew Cooper Cc: Keir Fraser , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 27.12.13 at 15:57, Andrew Cooper wrote: > Also fix the indentation of the arguments to copy_to_guest() to help clarify > that the 'ret = -EFAULT' is not part of the condition. > > Signed-off-by: Andrew Cooper > CC: Keir Fraser > CC: Jan Beulich > --- > xen/common/sysctl.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c > index 117e095..cd6184a 100644 > --- a/xen/common/sysctl.c > +++ b/xen/common/sysctl.c > @@ -230,15 +230,13 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) > u_sysctl) > } > > if ( copy_to_guest( > - op->u.page_offline.status, status, > - op->u.page_offline.end - op->u.page_offline.start + 1) ) > - { > + op->u.page_offline.status, status, > + op->u.page_offline.end - op->u.page_offline.start + 1) ) > ret = -EFAULT; > - break; > - } > + else > + copyback = 0; > > xfree(status); > - copyback = 0; This is wrong (and not covered by the title or description) - there's nothing to copy back here (apart from "status"), so this should remain unconditional. Jan