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 12:56:01 +0000 Message-ID: <52F4D7E1.9020002@citrix.com> References: <52F4B840020000780011A1E2@nat28.tlf.novell.com> <52F4B9BC020000780011A1F2@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3794812668176306307==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WBkyT-00030m-B7 for xen-devel@lists.xenproject.org; Fri, 07 Feb 2014 12:56:05 +0000 In-Reply-To: <52F4B9BC020000780011A1F2@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 --===============3794812668176306307== Content-Type: multipart/alternative; boundary="------------080701000106060701090301" --------------080701000106060701090301 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit 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 ? > well as when the input ID is out of range. > > Signed-off-by: Jan Beulich > > --- 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? ~Andrew > + 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 --------------080701000106060701090301 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
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 ?

well as when the input ID is out of range.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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?

~Andrew

+            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

--------------080701000106060701090301-- --===============3794812668176306307== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============3794812668176306307==--