]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vmwgfx: Fix memory allocation check and a leak of object fifo
authorColin Ian King <colin.king@canonical.com>
Fri, 14 May 2021 14:49:30 +0000 (15:49 +0100)
committerZack Rusin <zackr@vmware.com>
Fri, 14 May 2021 18:38:02 +0000 (14:38 -0400)
commit4575942a2bc01a1167974d72b504e577d81d8583
treee7d0f18a256432c5c3dc8fce73e98bc4fb554ab3
parent8b32af8b29a6177f525fdf4d7973025b4dcaee86
drm/vmwgfx: Fix memory allocation check and a leak of object fifo

The allocation of fifo is lacking an allocation failure check, so
fix this by adding one.

In the case where fifo->static_buffer fails to be allocated the
error return path neglects to kfree the fifo object. Fix this by
adding in the missing kfree.

Kudos to Dan Carpenter for spotting the missing kzalloc failure
check.

Addresses-Coverity: ("Resource leak")
Fixes: 1a11d05c2741 ("drm/vmwgfx: Add basic support for SVGA3")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210514144930.89813-1-colin.king@canonical.com
drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c