[patch] drm/vmwgfx: add error checking for kmalloc() (original) (raw)

Thomas Hellstrom thellstrom at vmware.com
Wed Feb 12 03:26:22 PST 2014


On 02/11/2014 05:04 PM, Dan Carpenter wrote:

Return -ENOMEM if kmalloc() fails.

Fixes: d5bde956630b ('drm/vmwgfx: Emulate legacy shaders on guest-backed devices v2') Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfxshader.c b/drivers/gpu/drm/vmwgfx/vmwgfxshader.c index 217d941b8176..23a32fd59a57 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfxshader.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfxshader.c @@ -779,6 +779,8 @@ vmwcompatshadermancreate(struct vmwprivate *devpriv) int ret; man = kzalloc(sizeof(*man), GFPKERNEL); + if (!man) + return ERRPTR(-ENOMEM); man->devpriv = devpriv; INITLISTHEAD(&man->list);

Thanks, Dan. A patch fixing the same problem has already been queued for the next vmwgfx-fixes!

/Thomas



More information about the dri-devel mailing list