mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 04:46:30 -04:00
binfmt_misc: simplify check_special_flags()
Replace the cont flag and the pointer increment repeated in every case with a for loop that returns from the default case, and shrink the multi-line 'C implies O' remark to one line. No functional change. Link: https://patch.msgid.link/20260710-work-binfmt_misc-locking-v3-18-a162f7cb58d6@kernel.org Reviewed-by: Jori Koolstra <jkoolstra@xs4all.nl> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
@@ -308,43 +308,31 @@ static char *scanarg(char *s, char del)
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *check_special_flags(char *sfs, struct binfmt_misc_entry *e)
|
||||
static char *check_special_flags(char *p, struct binfmt_misc_entry *e)
|
||||
{
|
||||
char *p = sfs;
|
||||
int cont = 1;
|
||||
|
||||
/* special flags */
|
||||
while (cont) {
|
||||
for (;; p++) {
|
||||
switch (*p) {
|
||||
case 'P':
|
||||
pr_debug("register: flag: P (preserve argv0)\n");
|
||||
p++;
|
||||
e->flags |= MISC_FMT_PRESERVE_ARGV0;
|
||||
break;
|
||||
case 'O':
|
||||
pr_debug("register: flag: O (open binary)\n");
|
||||
p++;
|
||||
e->flags |= MISC_FMT_OPEN_BINARY;
|
||||
break;
|
||||
case 'C':
|
||||
pr_debug("register: flag: C (preserve creds)\n");
|
||||
p++;
|
||||
/* this flags also implies the
|
||||
open-binary flag */
|
||||
e->flags |= (MISC_FMT_CREDENTIALS |
|
||||
MISC_FMT_OPEN_BINARY);
|
||||
/* C implies O */
|
||||
e->flags |= MISC_FMT_CREDENTIALS | MISC_FMT_OPEN_BINARY;
|
||||
break;
|
||||
case 'F':
|
||||
pr_debug("register: flag: F: open interpreter file now\n");
|
||||
p++;
|
||||
e->flags |= MISC_FMT_OPEN_FILE;
|
||||
break;
|
||||
default:
|
||||
cont = 0;
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user