Skip to content

Commit 1708000

Browse files
Tetsuo HandaJames Morris
authored andcommitted
TOMOYO: Remove __func__ from tomoyo_is_correct_path/domain
__func__ is used for only debug printk(). We can remove it. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
1 parent 2da5d31 commit 1708000

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

security/tomoyo/common.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,19 @@ static void tomoyo_normalize_line(unsigned char *buffer)
179179
* 1 = must / -1 = must not / 0 = don't care
180180
* @end_type: Should the pathname end with '/'?
181181
* 1 = must / -1 = must not / 0 = don't care
182-
* @function: The name of function calling me.
183182
*
184183
* Check whether the given filename follows the naming rules.
185184
* Returns true if @filename follows the naming rules, false otherwise.
186185
*/
187186
bool tomoyo_is_correct_path(const char *filename, const s8 start_type,
188-
const s8 pattern_type, const s8 end_type,
189-
const char *function)
187+
const s8 pattern_type, const s8 end_type)
190188
{
191189
const char *const start = filename;
192190
bool in_repetition = false;
193191
bool contains_pattern = false;
194192
unsigned char c;
195193
unsigned char d;
196194
unsigned char e;
197-
const char *original_filename = filename;
198195

199196
if (!filename)
200197
goto out;
@@ -283,25 +280,20 @@ bool tomoyo_is_correct_path(const char *filename, const s8 start_type,
283280
goto out;
284281
return true;
285282
out:
286-
printk(KERN_DEBUG "%s: Invalid pathname '%s'\n", function,
287-
original_filename);
288283
return false;
289284
}
290285

291286
/**
292287
* tomoyo_is_correct_domain - Check whether the given domainname follows the naming rules.
293288
* @domainname: The domainname to check.
294-
* @function: The name of function calling me.
295289
*
296290
* Returns true if @domainname follows the naming rules, false otherwise.
297291
*/
298-
bool tomoyo_is_correct_domain(const unsigned char *domainname,
299-
const char *function)
292+
bool tomoyo_is_correct_domain(const unsigned char *domainname)
300293
{
301294
unsigned char c;
302295
unsigned char d;
303296
unsigned char e;
304-
const char *org_domainname = domainname;
305297

306298
if (!domainname || strncmp(domainname, TOMOYO_ROOT_NAME,
307299
TOMOYO_ROOT_NAME_LEN))
@@ -344,8 +336,6 @@ bool tomoyo_is_correct_domain(const unsigned char *domainname,
344336
} while (*domainname);
345337
return true;
346338
out:
347-
printk(KERN_DEBUG "%s: Invalid domainname '%s'\n", function,
348-
org_domainname);
349339
return false;
350340
}
351341

@@ -1086,11 +1076,11 @@ static int tomoyo_update_manager_entry(const char *manager,
10861076
bool is_domain = false;
10871077

10881078
if (tomoyo_is_domain_def(manager)) {
1089-
if (!tomoyo_is_correct_domain(manager, __func__))
1079+
if (!tomoyo_is_correct_domain(manager))
10901080
return -EINVAL;
10911081
is_domain = true;
10921082
} else {
1093-
if (!tomoyo_is_correct_path(manager, 1, -1, -1, __func__))
1083+
if (!tomoyo_is_correct_path(manager, 1, -1, -1))
10941084
return -EINVAL;
10951085
}
10961086
saved_manager = tomoyo_get_name(manager);

security/tomoyo/common.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,10 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_domain_info * const domain);
520520
bool tomoyo_io_printf(struct tomoyo_io_buffer *head, const char *fmt, ...)
521521
__attribute__ ((format(printf, 2, 3)));
522522
/* Check whether the domainname is correct. */
523-
bool tomoyo_is_correct_domain(const unsigned char *domainname,
524-
const char *function);
523+
bool tomoyo_is_correct_domain(const unsigned char *domainname);
525524
/* Check whether the token is correct. */
526525
bool tomoyo_is_correct_path(const char *filename, const s8 start_type,
527-
const s8 pattern_type, const s8 end_type,
528-
const char *function);
526+
const s8 pattern_type, const s8 end_type);
529527
/* Check whether the token can be a domainname. */
530528
bool tomoyo_is_domain_def(const unsigned char *buffer);
531529
/* Check whether the given filename matches the given pattern. */

security/tomoyo/domain.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname,
136136
int error = is_delete ? -ENOENT : -ENOMEM;
137137
bool is_last_name = false;
138138

139-
if (!tomoyo_is_correct_path(program, 1, -1, -1, __func__))
139+
if (!tomoyo_is_correct_path(program, 1, -1, -1))
140140
return -EINVAL; /* No patterns allowed. */
141141
if (domainname) {
142142
if (!tomoyo_is_domain_def(domainname) &&
143-
tomoyo_is_correct_path(domainname, 1, -1, -1, __func__))
143+
tomoyo_is_correct_path(domainname, 1, -1, -1))
144144
is_last_name = true;
145-
else if (!tomoyo_is_correct_domain(domainname, __func__))
145+
else if (!tomoyo_is_correct_domain(domainname))
146146
return -EINVAL;
147147
saved_domainname = tomoyo_get_name(domainname);
148148
if (!saved_domainname)
@@ -357,12 +357,12 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname,
357357
bool is_last_name = false;
358358

359359
if (!tomoyo_is_domain_def(domainname) &&
360-
tomoyo_is_correct_path(domainname, 1, -1, -1, __func__))
360+
tomoyo_is_correct_path(domainname, 1, -1, -1))
361361
is_last_name = true;
362-
else if (!tomoyo_is_correct_domain(domainname, __func__))
362+
else if (!tomoyo_is_correct_domain(domainname))
363363
return -EINVAL;
364364
if (program) {
365-
if (!tomoyo_is_correct_path(program, 1, -1, -1, __func__))
365+
if (!tomoyo_is_correct_path(program, 1, -1, -1))
366366
return -EINVAL;
367367
saved_program = tomoyo_get_name(program);
368368
if (!saved_program)
@@ -556,8 +556,8 @@ static int tomoyo_update_alias_entry(const char *original_name,
556556
const struct tomoyo_path_info *saved_aliased_name;
557557
int error = is_delete ? -ENOENT : -ENOMEM;
558558

559-
if (!tomoyo_is_correct_path(original_name, 1, -1, -1, __func__) ||
560-
!tomoyo_is_correct_path(aliased_name, 1, -1, -1, __func__))
559+
if (!tomoyo_is_correct_path(original_name, 1, -1, -1) ||
560+
!tomoyo_is_correct_path(aliased_name, 1, -1, -1))
561561
return -EINVAL; /* No patterns allowed. */
562562
saved_original_name = tomoyo_get_name(original_name);
563563
saved_aliased_name = tomoyo_get_name(aliased_name);
@@ -659,7 +659,7 @@ struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char *
659659
const struct tomoyo_path_info *saved_domainname;
660660
bool found = false;
661661

662-
if (!tomoyo_is_correct_domain(domainname, __func__))
662+
if (!tomoyo_is_correct_domain(domainname))
663663
return NULL;
664664
saved_domainname = tomoyo_get_name(domainname);
665665
if (!saved_domainname)

security/tomoyo/file.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static int tomoyo_update_globally_readable_entry(const char *filename,
168168
const struct tomoyo_path_info *saved_filename;
169169
int error = is_delete ? -ENOENT : -ENOMEM;
170170

171-
if (!tomoyo_is_correct_path(filename, 1, 0, -1, __func__))
171+
if (!tomoyo_is_correct_path(filename, 1, 0, -1))
172172
return -EINVAL;
173173
saved_filename = tomoyo_get_name(filename);
174174
if (!saved_filename)
@@ -468,7 +468,7 @@ static int tomoyo_update_no_rewrite_entry(const char *pattern,
468468
const struct tomoyo_path_info *saved_pattern;
469469
int error = is_delete ? -ENOENT : -ENOMEM;
470470

471-
if (!tomoyo_is_correct_path(pattern, 0, 0, 0, __func__))
471+
if (!tomoyo_is_correct_path(pattern, 0, 0, 0))
472472
return -EINVAL;
473473
saved_pattern = tomoyo_get_name(pattern);
474474
if (!saved_pattern)
@@ -814,7 +814,7 @@ static int tomoyo_update_path_acl(const u8 type, const char *filename,
814814

815815
if (!domain)
816816
return -EINVAL;
817-
if (!tomoyo_is_correct_path(filename, 0, 0, 0, __func__))
817+
if (!tomoyo_is_correct_path(filename, 0, 0, 0))
818818
return -EINVAL;
819819
saved_filename = tomoyo_get_name(filename);
820820
if (!saved_filename)
@@ -898,8 +898,8 @@ static int tomoyo_update_path2_acl(const u8 type, const char *filename1,
898898

899899
if (!domain)
900900
return -EINVAL;
901-
if (!tomoyo_is_correct_path(filename1, 0, 0, 0, __func__) ||
902-
!tomoyo_is_correct_path(filename2, 0, 0, 0, __func__))
901+
if (!tomoyo_is_correct_path(filename1, 0, 0, 0) ||
902+
!tomoyo_is_correct_path(filename2, 0, 0, 0))
903903
return -EINVAL;
904904
saved_filename1 = tomoyo_get_name(filename1);
905905
saved_filename2 = tomoyo_get_name(filename2);

0 commit comments

Comments
 (0)