[PATCH] Security: Add break judge to smk_import_entry() in security/smack/smack_access.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: wzt.wzt
Date: Saturday, March 13, 2010 - 6:25 am

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>

---
 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] == '\'') {
-- 
1.6.5.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Security: Add break judge to smk_import_entry() in ..., wzt.wzt, (Sat Mar 13, 6:25 am)