Skip to content

Commit 9ee24b2

Browse files
Christoph HellwigGreg Ungerer
authored andcommitted
binfmt_flat: remove flat_reloc_valid
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>
1 parent 4b972a0 commit 9ee24b2

File tree

8 files changed

+1
-8
lines changed

8 files changed

+1
-8
lines changed

arch/arm/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#define flat_argvp_envp_on_stack() 1
1212
#define flat_old_ram_flag(flags) (flags)
13-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
1413

1514
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
1615
u32 *addr, u32 *persistent)

arch/c6x/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#define flat_argvp_envp_on_stack() 0
88
#define flat_old_ram_flag(flags) (flags)
9-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
109
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
1110
u32 *addr, u32 *persistent)
1211
{

arch/h8300/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#define flat_argvp_envp_on_stack() 1
1212
#define flat_old_ram_flag(flags) 1
13-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
1413
#define flat_set_persistent(relval, p) 0
1514

1615
/*

arch/m68k/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#define flat_argvp_envp_on_stack() 1
1212
#define flat_old_ram_flag(flags) (flags)
13-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
1413
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
1514
u32 *addr, u32 *persistent)
1615
{

arch/microblaze/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#define flat_argvp_envp_on_stack() 0
1717
#define flat_old_ram_flag(flags) (flags)
18-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
1918
#define flat_set_persistent(relval, p) 0
2019

2120
/*

arch/sh/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#define flat_argvp_envp_on_stack() 0
1515
#define flat_old_ram_flag(flags) (flags)
16-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
1716
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
1817
u32 *addr, u32 *persistent)
1918
{

arch/xtensa/include/asm/flat.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#define flat_argvp_envp_on_stack() 0
88
#define flat_old_ram_flag(flags) (flags)
9-
#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
109
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
1110
u32 *addr, u32 *persistent)
1211
{

fs/binfmt_flat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ calc_reloc(unsigned long r, struct lib_info *p, int curid, int internalp)
345345
start_code = p->lib_list[id].start_code;
346346
text_len = p->lib_list[id].text_len;
347347

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

0 commit comments

Comments
 (0)