aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_misc.c')
-rw-r--r--fs/binfmt_misc.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 97aff2879cda..9dcb05409ba7 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -9,6 +9,7 @@
9 9
10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 11
12#include <linux/kernel.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/init.h> 14#include <linux/init.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
@@ -521,9 +522,8 @@ static int parse_command(const char __user *buffer, size_t count)
521 522
522static void entry_status(Node *e, char *page) 523static void entry_status(Node *e, char *page)
523{ 524{
524 char *dp; 525 char *dp = page;
525 char *status = "disabled"; 526 const char *status = "disabled";
526 const char *flags = "flags: ";
527 527
528 if (test_bit(Enabled, &e->flags)) 528 if (test_bit(Enabled, &e->flags))
529 status = "enabled"; 529 status = "enabled";
@@ -533,12 +533,10 @@ static void entry_status(Node *e, char *page)
533 return; 533 return;
534 } 534 }
535 535
536 sprintf(page, "%s\ninterpreter %s\n", status, e->interpreter); 536 dp += sprintf(dp, "%s\ninterpreter %s\n", status, e->interpreter);
537 dp = page + strlen(page);
538 537
539 /* print the special flags */ 538 /* print the special flags */
540 sprintf(dp, "%s", flags); 539 dp += sprintf(dp, "flags: ");
541 dp += strlen(flags);
542 if (e->flags & MISC_FMT_PRESERVE_ARGV0) 540 if (e->flags & MISC_FMT_PRESERVE_ARGV0)
543 *dp++ = 'P'; 541 *dp++ = 'P';
544 if (e->flags & MISC_FMT_OPEN_BINARY) 542 if (e->flags & MISC_FMT_OPEN_BINARY)
@@ -550,21 +548,11 @@ static void entry_status(Node *e, char *page)
550 if (!test_bit(Magic, &e->flags)) { 548 if (!test_bit(Magic, &e->flags)) {
551 sprintf(dp, "extension .%s\n", e->magic); 549 sprintf(dp, "extension .%s\n", e->magic);
552 } else { 550 } else {
553 int i; 551 dp += sprintf(dp, "offset %i\nmagic ", e->offset);
554 552 dp = bin2hex(dp, e->magic, e->size);
555 sprintf(dp, "offset %i\nmagic ", e->offset);
556 dp = page + strlen(page);
557 for (i = 0; i < e->size; i++) {
558 sprintf(dp, "%02x", 0xff & (int) (e->magic[i]));
559 dp += 2;
560 }
561 if (e->mask) { 553 if (e->mask) {
562 sprintf(dp, "\nmask "); 554 dp += sprintf(dp, "\nmask ");
563 dp += 6; 555 dp = bin2hex(dp, e->mask, e->size);
564 for (i = 0; i < e->size; i++) {
565 sprintf(dp, "%02x", 0xff & (int) (e->mask[i]));
566 dp += 2;
567 }
568 } 556 }
569 *dp++ = '\n'; 557 *dp++ = '\n';
570 *dp = '\0'; 558 *dp = '\0';