All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daniel Wagner <daniel.wagner@bmw-carit.de>
Subject: [PATCH] binfmt_em86: load_em86: Remove unused i_arg variable and constify i_name
Date: Wed, 10 Feb 2016 14:34:43 +0100	[thread overview]
Message-ID: <1455111283-22854-1-git-send-email-daniel.wagner@bmw-carit.de> (raw)

i_arg is not used at all therefore remove it. This also prevents
an error in case -Werror=i-Werror=incompatible-pointer-types
is enabled:

fs/binfmt_em86.c:73:35: error: passing argument 2 of ‘copy_strings_kernel’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   retval = copy_strings_kernel(1, &i_arg, bprm);


The second error would come from i_name which is defined as char pointer
without the const attribute.

fs/binfmt_em86.c:71:34: error: passing argument 2 of ‘copy_strings_kernel’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  retval = copy_strings_kernel(1, &i_name, bprm);


While at it, check the remove_arg_zero return value too.

fs/binfmt_em86.c:68:2: warning: ignoring return value of ‘remove_arg_zero’, declared with attribute warn_unused_result [-Wunused-result]
  remove_arg_zero(bprm);
  ^

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
---
 fs/binfmt_em86.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c
index 4905385..bc8fff2 100644
--- a/fs/binfmt_em86.c
+++ b/fs/binfmt_em86.c
@@ -24,7 +24,8 @@
 
 static int load_em86(struct linux_binprm *bprm)
 {
-	char *interp, *i_name, *i_arg;
+	const char *i_name;
+	char *interp;
 	struct file * file;
 	int retval;
 	struct elfhdr	elf_ex;
@@ -55,7 +56,6 @@ static int load_em86(struct linux_binprm *bprm)
 	 */
 	interp = EM86_INTERP;
 	i_name = EM86_I_NAME;
-	i_arg = NULL;		/* We reserve the right to add an arg later */
 
 	/*
 	 * Splice in (1) the interpreter's name for argv[0]
@@ -65,15 +65,11 @@ static int load_em86(struct linux_binprm *bprm)
 	 * This is done in reverse order, because of how the
 	 * user environment and arguments are stored.
 	 */
-	remove_arg_zero(bprm);
+	retval = remove_arg_zero(bprm);
+	if (retval < 0) return retval;
 	retval = copy_strings_kernel(1, &bprm->filename, bprm);
 	if (retval < 0) return retval; 
 	bprm->argc++;
-	if (i_arg) {
-		retval = copy_strings_kernel(1, &i_arg, bprm);
-		if (retval < 0) return retval; 
-		bprm->argc++;
-	}
 	retval = copy_strings_kernel(1, &i_name, bprm);
 	if (retval < 0)	return retval;
 	bprm->argc++;
-- 
2.5.0

                 reply	other threads:[~2016-02-10 13:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1455111283-22854-1-git-send-email-daniel.wagner@bmw-carit.de \
    --to=daniel.wagner@bmw-carit.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.