drm/vmwgfx: Fix possible usage of an uninitialized variable
authorZack Rusin <zackr@vmware.com>
Wed, 15 Dec 2021 20:02:24 +0000 (15:02 -0500)
committerZack Rusin <zackr@vmware.com>
Thu, 16 Dec 2021 15:33:13 +0000 (10:33 -0500)
commit60c9ecd705be3a28f79d70ea21c3939db668bf46
treed3a241f4969e6c30bcd3fce2a98cc34258a52a0e
parent11343099d5ae6c7411da1425b6b162c89fb5bf10
drm/vmwgfx: Fix possible usage of an uninitialized variable

vmw_user_bo_lookup can fail to lookup user buffers, especially because
the buffer handles come from the userspace. The return value has
to be checked before the buffers are put back.

This was spotted by Dan's Smatch statick checker:
    drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:574 vmw_user_bo_synccpu_release()
error: uninitialized symbol 'vmw_bo'.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 8afa13a0583f ("drm/vmwgfx: Implement DRIVER_GEM")
Reviewed-by: Martin Krastev <krastevm@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211215200224.3693345-1-zack@kde.org
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c