Skip to content

Commit

Permalink
[SPARC64]: 8-byte align return value from compat_alloc_user_space()
Browse files Browse the repository at this point in the history
Otherwise we get a ton of unaligned exceptions, for cases such
as compat_sys_msgrcv() which go:

	p = compat_alloc_user_space(second + sizeof(struct msgbuf));

and here 'second' can for example be an arbitrary odd value.

Based upon a bug report from Jurij Smakov.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 23, 2006
1 parent 5cfc35c commit a94b1d1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/asm-sparc64/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
return (u32)(unsigned long)uptr;
}

static __inline__ void __user *compat_alloc_user_space(long len)
static inline void __user *compat_alloc_user_space(long len)
{
struct pt_regs *regs = current_thread_info()->kregs;
unsigned long usp = regs->u_regs[UREG_I6];
Expand All @@ -174,7 +174,10 @@ static __inline__ void __user *compat_alloc_user_space(long len)
else
usp &= 0xffffffffUL;

return (void __user *) (usp - len);
usp -= len;
usp &= ~0x7UL;

return (void __user *) usp;
}

struct compat_ipc64_perm {
Expand Down

0 comments on commit a94b1d1

Please sign in to comment.