From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 2/4] flask: fix error propagation from flask_security_set_bool() Date: Fri, 7 Feb 2014 13:07:27 +0000 Message-ID: <52F4DA8F.1040407@citrix.com> References: <52F4B840020000780011A1E2@nat28.tlf.novell.com> <52F4B9BC020000780011A1F2@nat28.tlf.novell.com> <52F4D7E1.9020002@citrix.com> <52F4E7E3020000780011A3D7@nat28.tlf.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 1WBl9X-00049R-It for xen-devel@lists.xenproject.org; Fri, 07 Feb 2014 13:07:31 +0000 In-Reply-To: <52F4E7E3020000780011A3D7@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: George Dunlap , xen-devel , dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org On 07/02/14 13:04, Jan Beulich wrote: >>>> On 07.02.14 at 13:56, Andrew Cooper wrote: >> On 07/02/14 09:47, Jan Beulich wrote: >>> The function should return an error when flask_security_make_bools() as >> when flask_security_make_bools() fails ? > Oops, yes of course. Corrected. > >>> --- a/xen/xsm/flask/flask_op.c >>> +++ b/xen/xsm/flask/flask_op.c >>> @@ -364,9 +364,10 @@ static int flask_security_set_bool(struc >>> else >>> { >>> if ( !bool_pending_values ) >>> - flask_security_make_bools(); >>> - >>> - if ( arg->bool_id >= bool_num ) >>> + rv = flask_security_make_bools(); >>> + if ( !rv && arg->bool_id >= bool_num ) >> Surely you want "rv || arg->" if you want to catch both >> flask_security_make_bools() failing as well as the input ID being out of >> range? > Yes, which is what the code does - it just cares to not clobber "rv" > if that got already set non-zero from the function call. See the > context below. > > Jan Ah yes. Reviewed-by: Andrew Cooper > >>> + rv = -ENOENT; >>> + if ( rv ) >>> goto out; >>> >>> bool_pending_values[arg->bool_id] = !!(arg->new_value); >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xen.org >>> http://lists.xen.org/xen-devel > >