From 9508a62d83bb3f16b284b29e6f6ccc0873872f37 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 19 Oct 2015 21:48:41 +0100 Subject: [PATCH] brk: revert the MSP340 change to brk() brk sets the memory address to the one asked. If you misalign in then it's your problem in userspace. Some of our sbrk() users in userspace may well be wrong, but they need to be fixed not brk()! --- Kernel/syscall_proc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Kernel/syscall_proc.c b/Kernel/syscall_proc.c index a48016c4..e56081e5 100644 --- a/Kernel/syscall_proc.c +++ b/Kernel/syscall_proc.c @@ -225,17 +225,16 @@ arg_t _brk(void) need to make this something like if (brk_valid(addr)) so we can keep it portable */ - uaddr_t aligned = (uaddr_t) ALIGNUP(addr); - if (aligned >= brk_limit()) { + if (addr >= brk_limit()) { kprintf("%d: out of memory\n", udata.u_ptab->p_pid); udata.u_error = ENOMEM; return -1; } /* If we have done a break that gives us more room we must zero the extra as we no longer guarantee it is clear already */ - if (aligned > udata.u_break) - uzero((void *)udata.u_break, aligned - udata.u_break); - udata.u_break = aligned; + if (addr > udata.u_break) + uzero((void *)udata.u_break, addr - udata.u_break); + udata.u_break = addr; return 0; } -- 2.34.1