lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201121135736.295705-4-alx.manpages@gmail.com>
Date:   Sat, 21 Nov 2020 14:57:35 +0100
From:   Alejandro Colomar <alx.manpages@...il.com>
To:     Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org
Cc:     Alejandro Colomar <alx.manpages@...il.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 3/4] fs/attr.c, fs/bad_inode.c, fs/binfmt_aout.c, fs/binfmt_elf.c: Cosmetic

Slightly non-trivial changes:

- Move declarations to the top of function definitions.
- Split multiple assignments in a single line to
  multiple lines with a signle assignment each.

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---
 fs/attr.c        |  5 ++---
 fs/bad_inode.c   |  5 +++--
 fs/binfmt_aout.c |  3 ++-
 fs/binfmt_elf.c  | 26 ++++++++++++++++----------
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/fs/attr.c b/fs/attr.c
index b32ad8c678a5..61f7a75ac330 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -62,13 +62,14 @@ int setattr_prepare(struct dentry *dentry, struct iattr *attr)
 {
 	struct inode *inode = d_inode(dentry);
 	unsigned int ia_valid = attr->ia_valid;
+	int error;
 
 	/*
 	 * First check size constraints.  These can't be overridden using
 	 * ATTR_FORCE.
 	 */
 	if (ia_valid & ATTR_SIZE) {
-		int error = inode_newsize_ok(inode, attr->ia_size);
+		error = inode_newsize_ok(inode, attr->ia_size);
 		if (error)
 			return error;
 	}
@@ -105,8 +106,6 @@ int setattr_prepare(struct dentry *dentry, struct iattr *attr)
 kill_priv:
 	/* User has permission for the change */
 	if (ia_valid & ATTR_KILL_PRIV) {
-		int error;
-
 		error = security_inode_killpriv(dentry);
 		if (error)
 			return error;
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index f0457b6c17dc..4c5e677ec423 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -200,8 +200,9 @@ void make_bad_inode(struct inode *inode)
 	remove_inode_hash(inode);
 
 	inode->i_mode = S_IFREG;
-	inode->i_atime = inode->i_mtime = inode->i_ctime =
-		current_time(inode);
+	inode->i_ctime = current_time(inode);
+	inode->i_mtime = inode->i_ctime;
+	inode->i_atime = inode->i_ctime;
 	inode->i_op = &bad_inode_ops;
 	inode->i_opflags &= ~IOP_XATTR;
 	inode->i_fop = &bad_file_ops;
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 92d6b70ddab0..976d5f1565e1 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -97,7 +97,8 @@ static unsigned long __user *create_aout_tables(char __user *p, struct linux_bin
 		} while (c);
 	}
 	put_user(NULL, argv);
-	current->mm->arg_end = current->mm->env_start = (unsigned long)p;
+	current->mm->env_start = (unsigned long)p;
+	current->mm->arg_end = (unsigned long)p;
 	while (envc-- > 0) {
 		char c;
 
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 955927ac2b80..b5e1e0a0917a 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1035,13 +1035,12 @@ static int load_elf_binary(struct linux_binprm *bprm)
 		unsigned long k, vaddr;
 		unsigned long total_size = 0;
 		unsigned long alignment;
+		unsigned long nbyte;
 
 		if (elf_ppnt->p_type != PT_LOAD)
 			continue;
 
 		if (unlikely(elf_brk > elf_bss)) {
-			unsigned long nbyte;
-
 			/*
 			 * There was a PT_LOAD segment with p_memsz > p_filesz
 			 * before this one. Map anonymous pages, if needed,
@@ -1277,10 +1276,12 @@ static int load_elf_binary(struct linux_binprm *bprm)
 		 */
 		if (IS_ENABLED(CONFIG_ARCH_HAS_ELF_RANDOMIZE) &&
 		    elf_ex->e_type == ET_DYN && !interpreter) {
-			mm->brk = mm->start_brk = ELF_ET_DYN_BASE;
+			mm->start_brk	= ELF_ET_DYN_BASE;
+			mm->brk		= ELF_ET_DYN_BASE;
 		}
 
-		mm->brk = mm->start_brk = arch_randomize_brk(mm);
+		mm->start_brk = arch_randomize_brk(mm);
+		mm->brk = mm->start_brk;
 #ifdef compat_brk_randomized
 		current->brk_randomized = 1;
 #endif
@@ -1506,7 +1507,8 @@ static void fill_note(struct memelfnote *note, const char *name, int type,
 static void fill_prstatus(struct elf_prstatus *prstatus,
 			  struct task_struct *p, long signr)
 {
-	prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
+	prstatus->pr_cursig = signr;
+	prstatus->pr_info.si_signo = signr;
 	prstatus->pr_sigpend = p->pending.signal.sig[0];
 	prstatus->pr_sighold = p->blocked.sig[0];
 	rcu_read_lock();
@@ -1618,6 +1620,7 @@ static int fill_files_note(struct memelfnote *note)
 	user_long_t *data;
 	user_long_t *start_end_ofs;
 	char *name_base, *name_curpos;
+	unsigned int shift_bytes;
 
 	/* *Estimated* file count and total data size needed */
 	count = mm->map_count;
@@ -1639,7 +1642,8 @@ static int fill_files_note(struct memelfnote *note)
 		return -ENOMEM;
 
 	start_end_ofs = data + 2;
-	name_base = name_curpos = ((char *)data) + names_ofs;
+	name_curpos = ((char *)data) + names_ofs;
+	name_base = name_curpos;
 	remaining = size - names_ofs;
 	count = 0;
 	for (vma = mm->mmap; vma; vma = vma->vm_next) {
@@ -1681,7 +1685,7 @@ static int fill_files_note(struct memelfnote *note)
 	 */
 	n = mm->map_count - count;
 	if (n != 0) {
-		unsigned shift_bytes = n * 3 * sizeof(data[0]);
+		shift_bytes = n * 3 * sizeof(data[0]);
 		memmove(name_base - shift_bytes, name_base,
 			name_curpos - name_base);
 		name_curpos -= shift_bytes;
@@ -1922,11 +1926,12 @@ static int write_note_info(struct elf_note_info *info,
 
 static void free_note_info(struct elf_note_info *info)
 {
+	struct elf_thread_core_info *t;
 	struct elf_thread_core_info *threads = info->thread;
+	unsigned int i;
 
 	while (threads) {
-		unsigned int i;
-		struct elf_thread_core_info *t = threads;
+		t = threads;
 		threads = t->next;
 		WARN_ON(t->notes[0].data && t->notes[0].data != &t->prstatus);
 		for (i = 1; i < info->thread_notes; ++i)
@@ -2209,7 +2214,8 @@ static int elf_core_dump(struct coredump_params *cprm)
 		offset += sz;
 	}
 
-	dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
+	offset = roundup(offset, ELF_EXEC_PAGESIZE);
+	dataoff = offset;
 
 	offset += vma_data_size;
 	offset += elf_core_extra_data_size();
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ