public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Paul Moore <paul@paul-moore.com>, Namhyung Kim <namhyung@kernel.org>
Cc: Eric Paris <eparis@parisplace.org>,
	selinux@tycho.nsa.gov, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] selinux: simple cleanup for cond_read_node()
Date: Thu, 19 Jun 2014 08:03:46 -0400	[thread overview]
Message-ID: <53A2D1A2.9050900@tycho.nsa.gov> (raw)
In-Reply-To: <1719649.5PAcuqR8Pm@sifl>

On 06/18/2014 03:36 PM, Paul Moore wrote:
> On Sunday, June 15, 2014 01:19:01 AM Namhyung Kim wrote:
>> The node->cur_state and len can be read in a single call of next_entry().
>> And setting len before reading is a dead write so can be eliminated.
>>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>> ---
>>  security/selinux/ss/conditional.c | 9 ++-------
>>  1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/security/selinux/ss/conditional.c
>> b/security/selinux/ss/conditional.c index 377d148e7157..4766a38fae9a 100644
>> --- a/security/selinux/ss/conditional.c
>> +++ b/security/selinux/ss/conditional.c
>> @@ -402,19 +402,14 @@ static int cond_read_node(struct policydb *p, struct
>> cond_node *node, void *fp) int rc;
>>  	struct cond_expr *expr = NULL, *last = NULL;
>>
>> -	rc = next_entry(buf, fp, sizeof(u32));
>> +	rc = next_entry(buf, fp, sizeof(buf));
> 
> This is a bit nit-picky, but how about using "sizeof(u32) * 2"?  It is more 
> consistent with the rest of the function and helps underscore that we are 

Concur - I don't want to assume that the buf size is always the same as
the next read size (e.g. we sometimes use the same buf for multiple reads).




      parent reply	other threads:[~2014-06-19 12:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14 16:19 [PATCH 1/2] selinux: simple cleanup for cond_read_node() Namhyung Kim
2014-06-14 16:19 ` [PATCH 2/2] selinux: fix a possible memory leak in cond_read_node() Namhyung Kim
2014-06-18 19:41   ` Paul Moore
2014-06-18 19:36 ` [PATCH 1/2] selinux: simple cleanup for cond_read_node() Paul Moore
2014-06-18 23:58   ` Namhyung Kim
2014-06-19 18:59     ` Paul Moore
2014-06-19 12:03   ` Stephen Smalley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53A2D1A2.9050900@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=eparis@parisplace.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paul@paul-moore.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox