All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, laurent@vivier.eu,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v2 02/36] linux-user: Fix style problems in linuxload.c
Date: Tue,  6 Jul 2021 16:48:58 -0700	[thread overview]
Message-ID: <20210706234932.356913-3-richard.henderson@linaro.org> (raw)
In-Reply-To: <20210706234932.356913-1-richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/linuxload.c | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c
index a27e1d0d8b..9d4eb5e94b 100644
--- a/linux-user/linuxload.c
+++ b/linux-user/linuxload.c
@@ -1,59 +1,57 @@
 /* Code for loading Linux executables.  Mostly linux kernel code.  */
 
 #include "qemu/osdep.h"
-
 #include "qemu.h"
 
 #define NGROUPS 32
 
 /* ??? This should really be somewhere else.  */
-abi_long memcpy_to_target(abi_ulong dest, const void *src,
-                          unsigned long len)
+abi_long memcpy_to_target(abi_ulong dest, const void *src, unsigned long len)
 {
     void *host_ptr;
 
     host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
-    if (!host_ptr)
+    if (!host_ptr) {
         return -TARGET_EFAULT;
+    }
     memcpy(host_ptr, src, len);
     unlock_user(host_ptr, dest, 1);
     return 0;
 }
 
-static int count(char ** vec)
+static int count(char **vec)
 {
-    int		i;
+    int i;
 
-    for(i = 0; *vec; i++) {
+    for (i = 0; *vec; i++) {
         vec++;
     }
-
-    return(i);
+    return i;
 }
 
 static int prepare_binprm(struct linux_binprm *bprm)
 {
-    struct stat		st;
+    struct stat st;
     int mode;
     int retval;
 
-    if(fstat(bprm->fd, &st) < 0) {
-        return(-errno);
+    if (fstat(bprm->fd, &st) < 0) {
+        return -errno;
     }
 
     mode = st.st_mode;
-    if(!S_ISREG(mode)) {	/* Must be regular file */
-        return(-EACCES);
+    if (!S_ISREG(mode)) {   /* Must be regular file */
+        return -EACCES;
     }
-    if(!(mode & 0111)) {	/* Must have at least one execute bit set */
-        return(-EACCES);
+    if (!(mode & 0111)) {   /* Must have at least one execute bit set */
+        return -EACCES;
     }
 
     bprm->e_uid = geteuid();
     bprm->e_gid = getegid();
 
     /* Set-uid? */
-    if(mode & S_ISUID) {
+    if (mode & S_ISUID) {
         bprm->e_uid = st.st_uid;
     }
 
@@ -125,8 +123,8 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
 }
 
 int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
-             struct target_pt_regs * regs, struct image_info *infop,
-             struct linux_binprm *bprm)
+                struct target_pt_regs *regs, struct image_info *infop,
+                struct linux_binprm *bprm)
 {
     int retval;
 
@@ -139,7 +137,7 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
 
     retval = prepare_binprm(bprm);
 
-    if(retval>=0) {
+    if (retval >= 0) {
         if (bprm->buf[0] == 0x7f
                 && bprm->buf[1] == 'E'
                 && bprm->buf[2] == 'L'
@@ -157,11 +155,11 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
         }
     }
 
-    if(retval>=0) {
+    if (retval >= 0) {
         /* success.  Initialize important registers */
         do_init_thread(regs, infop);
         return retval;
     }
 
-    return(retval);
+    return retval;
 }
-- 
2.25.1



  parent reply	other threads:[~2021-07-06 23:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 23:48 [PATCH v2 00/36] linux-user: Signal trampolines and vdsos Richard Henderson
2021-07-06 23:48 ` [PATCH v2 01/36] linux-user: Add infrastructure for a signal trampoline page Richard Henderson
2021-07-06 23:48 ` Richard Henderson [this message]
2021-07-07 19:22   ` [PATCH v2 02/36] linux-user: Fix style problems in linuxload.c Laurent Vivier
2021-07-06 23:48 ` [PATCH v2 03/36] linux-user: Introduce imgsrc_read, imgsrc_read_alloc Richard Henderson
2021-07-06 23:49 ` [PATCH v2 04/36] linux-user: Tidy loader_exec Richard Henderson
2021-07-07  8:21   ` Philippe Mathieu-Daudé
2021-07-06 23:49 ` [PATCH v2 05/36] linux-user: Do not clobber bprm_buf swapping ehdr Richard Henderson
2021-07-06 23:49 ` [PATCH v2 06/36] linux-user: Use ImageSource in load_elf_image Richard Henderson
2021-07-06 23:49 ` [PATCH v2 07/36] linux-user: Use ImageSource in load_symbols Richard Henderson
2021-07-06 23:49 ` [PATCH v2 08/36] linux-user: Replace bprm->fd with bprm->src.fd Richard Henderson
2021-07-06 23:49 ` [PATCH v2 09/36] linux-user: Introduce imgsrc_mmap Richard Henderson
2021-07-06 23:49 ` [PATCH v2 10/36] linux-user: Load vdso image if available Richard Henderson
2021-07-06 23:49 ` [PATCH v2 11/36] linux-user: Add gen-vdso tool Richard Henderson
2021-07-06 23:49 ` [PATCH v2 12/36] linux-user/aarch64: Add vdso and use it for rt_sigreturn Richard Henderson
2021-07-06 23:49 ` [PATCH v2 13/36] linux-user/arm: Drop v1 signal frames Richard Henderson
2021-07-07  8:19   ` Philippe Mathieu-Daudé
2021-07-07 17:35   ` Peter Maydell
2021-07-06 23:49 ` [PATCH v2 14/36] linux-user/arm: Drop "_v2" from symbols in signal.c Richard Henderson
2021-07-07  8:19   ` Philippe Mathieu-Daudé
2021-07-06 23:49 ` [PATCH v2 15/36] target/arm: Add isar_feature_aa32_a32 Richard Henderson
2021-07-06 23:49 ` [PATCH v2 16/36] linux-user/arm: Add vdso and use it for rt_sigreturn Richard Henderson
2021-07-06 23:49 ` [PATCH v2 17/36] linux-user/alpha: Implement setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 18/36] linux-user/cris: " Richard Henderson
2021-07-06 23:49 ` [PATCH v2 19/36] linux-user/hexagon: " Richard Henderson
2021-07-12 23:08   ` Taylor Simpson
2021-07-06 23:49 ` [PATCH v2 20/36] linux-user/hppa: Add vdso and use it for rt_sigreturn Richard Henderson
2021-07-06 23:49 ` [PATCH v2 21/36] linux-user/x86_64: Raise SIGSEGV if SA_RESTORER not set Richard Henderson
2021-07-06 23:49 ` [PATCH v2 22/36] linux-user/i386: Add vdso and use it for sigreturn Richard Henderson
2021-07-07 20:28   ` Richard Henderson
2021-07-06 23:49 ` [PATCH v2 23/36] linux-user/x86_64: Add vdso Richard Henderson
2021-07-06 23:49 ` [PATCH v2 24/36] linux-user/m68k: Implement setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 25/36] linux-user/microblaze: " Richard Henderson
2021-07-06 23:49 ` [PATCH v2 26/36] linux-user/mips: Tidy install_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 27/36] linux-user/mips: Implement setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 28/36] linux-user/nios2: Document non-use of setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 29/36] linux-user/openrisc: Implement setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 30/36] target/ppc: Simplify encode_trampoline Richard Henderson
2021-07-06 23:49 ` [PATCH v2 31/36] linux-user/ppc: Implement setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 32/36] linux-user/riscv: Add vdso and use it for sigreturn Richard Henderson
2021-07-06 23:49   ` Richard Henderson
2021-07-06 23:49 ` [PATCH v2 33/36] linux-user/s390x: Implement setup_sigtramp Richard Henderson
2021-07-06 23:49 ` [PATCH v2 34/36] linux-user/sh4: " Richard Henderson
2021-07-06 23:49 ` [PATCH v2 35/36] linux-user/sparc: " Richard Henderson
2021-07-06 23:49 ` [PATCH v2 36/36] linux-user/xtensa: " Richard Henderson
2021-07-08 10:55 ` [PATCH v2 00/36] linux-user: Signal trampolines and vdsos Philippe Mathieu-Daudé
2021-09-01  9:36 ` Peter Maydell
2021-09-03 13:39   ` Alex Bennée
2021-09-03 15:39     ` Richard Henderson

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=20210706234932.356913-3-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    /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.