Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752508AbcLEJOO (ORCPT ); Mon, 5 Dec 2016 04:14:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:36320 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbcLEJN5 (ORCPT ); Mon, 5 Dec 2016 04:13:57 -0500 Subject: Re: [PATCH 1/1 v2] xen: xenbus: set error code on failure To: Pan Bian , David Vrabel , Boris Ostrovsky , xen-devel@lists.xenproject.org References: <1480926142-19882-1-git-send-email-bianpan2016@163.com> Cc: linux-kernel@vger.kernel.org From: Juergen Gross Message-ID: <050e52af-7f58-1d46-51c0-ac314b99212f@suse.com> Date: Mon, 5 Dec 2016 10:00:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1480926142-19882-1-git-send-email-bianpan2016@163.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 972 Lines: 36 On 05/12/16 09:22, Pan Bian wrote: > Variable err is initialized with 0. As a result, the return value may > be 0 even if get_zeroed_page() fails to allocate memory. This patch fixes > the bug, initializing err with "-ENOMEM". > > v1 is reviewed by: Juergen Gross I didn't say so. > Signed-off-by: Pan Bian Now I do: Reviewed-by: Juergen Gross Juergen > --- > drivers/xen/xenbus/xenbus_probe.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c > index 33a31cf..8178d5b 100644 > --- a/drivers/xen/xenbus/xenbus_probe.c > +++ b/drivers/xen/xenbus/xenbus_probe.c > @@ -702,7 +702,7 @@ static int __init xenbus_probe_initcall(void) > */ > static int __init xenstored_local_init(void) > { > - int err = 0; > + int err = -ENOMEM; > unsigned long page = 0; > struct evtchn_alloc_unbound alloc_unbound; > >