[PATCH] qxl: apply limit to relocs_num in qxl_process_single_command

Daniel Vetter daniel at ffwll.ch
Tue Feb 16 12:45:45 UTC 2016


On Tue, Feb 16, 2016 at 12:49 PM, Gerd Hoffmann <kraxel at redhat.com> wrote:
> +       if (cmd->relocs_num > 65536)
> +               return -EINVAL;
>         reloc_info = kmalloc(sizeof(struct qxl_reloc_info) * cmd->relocs_num, GFP_KERNEL);
>         if (!reloc_info)
>                 return -ENOMEM;

Why not just use one of the array alloc functions like kcalloc?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list