Skip to content

Commit

Permalink
binfmt_flat: remove flat_reloc_valid
Browse files Browse the repository at this point in the history
This helper is the same for all architectures, open code it in the only
caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
  • Loading branch information
Christoph Hellwig authored and Greg Ungerer committed Jun 23, 2019
1 parent 4b972a0 commit 9ee24b2
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion arch/arm/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#define flat_argvp_envp_on_stack() 1
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))

static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
u32 *addr, u32 *persistent)
Expand Down
1 change: 0 additions & 1 deletion arch/c6x/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
u32 *addr, u32 *persistent)
{
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#define flat_argvp_envp_on_stack() 1
#define flat_old_ram_flag(flags) 1
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
#define flat_set_persistent(relval, p) 0

/*
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#define flat_argvp_envp_on_stack() 1
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
u32 *addr, u32 *persistent)
{
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
#define flat_set_persistent(relval, p) 0

/*
Expand Down
1 change: 0 additions & 1 deletion arch/sh/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
u32 *addr, u32 *persistent)
{
Expand Down
1 change: 0 additions & 1 deletion arch/xtensa/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#define flat_argvp_envp_on_stack() 0
#define flat_old_ram_flag(flags) (flags)
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
u32 *addr, u32 *persistent)
{
Expand Down
2 changes: 1 addition & 1 deletion fs/binfmt_flat.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ calc_reloc(unsigned long r, struct lib_info *p, int curid, int internalp)
start_code = p->lib_list[id].start_code;
text_len = p->lib_list[id].text_len;

if (!flat_reloc_valid(r, start_brk - start_data + text_len)) {
if (r > start_brk - start_data + text_len) {
pr_err("reloc outside program 0x%lx (0 - 0x%lx/0x%lx)",
r, start_brk-start_data+text_len, text_len);
goto failed;
Expand Down

0 comments on commit 9ee24b2

Please sign in to comment.