Thomas,

On Fri, Jul 7, 2017 at 11:01 PM, Thomas Meyer <tho...@m3y3r.de> wrote:
> Hard code max size. Taken from
> https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/common/x86-xstate.h
>
> Signed-off-by: Thomas Meyer <tho...@m3y3r.de>
> ---
>  arch/um/os-Linux/skas/process.c  | 22 ++++++++++++++++++----
>  arch/x86/um/os-Linux/registers.c | 16 +++++++++++-----
>  arch/x86/um/user-offsets.c       |  2 +-
>  3 files changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
> index 03b3c4cc7735..1a7cce387950 100644
> --- a/arch/um/os-Linux/skas/process.c
> +++ b/arch/um/os-Linux/skas/process.c
> @@ -91,19 +91,25 @@ extern unsigned long current_stub_stack(void);
>  static void get_skas_faultinfo(int pid, struct faultinfo *fi)
>  {
>         int err;
> -       unsigned long fpregs[FP_SIZE];
> +       void * fpregs;
> +
> +       fpregs = malloc(FP_SIZE * sizeof(unsigned long));
> +       if(fpregs == NULL) {
> +               printk(UM_KERN_ERR "cannot alloc memory for 
> save_fp_registers!");
> +               goto errout;
> +       }

Having a malloc() here is rather expensive.
I suggest to allocate a buffer in userspace() that can be used in
get_skas_faultinfo().

Thanks,
//richard
-- 
Thanks,
//richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to