mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: wzt.wzt@gmail.com
Cc: linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH] Security: Add break judge to smk_import_entry() in security/smack/smack_access.c
Date: Sat, 13 Mar 2010 11:36:50 -0800	[thread overview]
Message-ID: <4B9BE952.7080808@schaufler-ca.com> (raw)
In-Reply-To: <20100313132545.GB3126@localhost.localdomain>

wzt.wzt@gmail.com wrote:
> In smk_import_entry(), smack[i] = '\0' was set if found = 1, so:
> if (found)
> 	smack[i] = '\0';
> No need to continue again, just can break the loop.
>
> Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
>   
Nacked-by: Casey Schaufler <casey@schaufler-ca.com>
> ---
>  security/smack/smack_access.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c
> index 0f9ac81..0e064e8 100644
> --- a/security/smack/smack_access.c
> +++ b/security/smack/smack_access.c
> @@ -318,7 +318,7 @@ struct smack_known *smk_import_entry(const char *string, int len)
>  
>  	for (i = 0, found = 0; i < SMK_LABELLEN; i++) {
>  		if (found)
> -			smack[i] = '\0';
> +			break;
>  		else if (i >= len || string[i] > '~' || string[i] <= ' ' ||
>  			 string[i] == '/' || string[i] == '"' ||
>  			 string[i] == '\\' || string[i] == '\'') {
>   
The intention of this code is to fill the label. Yes, I could zero the
target in advance and break here but would that be significantly better?
I don't see that it would be. In any case, the change you suggest would
not suffice by itself.

Are you looking for a real project to work on? I could suggest a
thing or two that would be much more welcome than these attempts
at pointless code change.




      reply	other threads:[~2010-03-13 19:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-13 13:25 wzt.wzt
2010-03-13 19:36 ` Casey Schaufler [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=4B9BE952.7080808@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=wzt.wzt@gmail.com \
    /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

Powered by JetHome