]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vmwgfx: clean up some error pointer checking
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 19 Jul 2022 09:47:22 +0000 (12:47 +0300)
committerZack Rusin <zackr@vmware.com>
Thu, 4 Aug 2022 15:27:50 +0000 (11:27 -0400)
commit55671b4931a3f7abd3d2ed0c6fb0425091651119
treeff2f58ea3e3287be2a2db4901574db0278b02ba8
parentec381676fd880ebba5ded3e34a8021bd0d0cd4f1
drm/vmwgfx: clean up some error pointer checking

The vmw_user_bo_noref_lookup() function cannot return NULL.  If it
could, then this function would return PTR_ERR(NULL) which is success.
Returning success without initializing "*vmw_bo_p = vmw_bo;" would
lead to an uninitialized variable bug in the caller.  Smatch complains
about this:

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:1177 vmw_translate_mob_ptr() warn: passing zero to 'PTR_ERR'
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:1314 vmw_cmd_dx_bind_query() error: uninitialized symbol 'vmw_bo'.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YtZ9qrKeBqmmK8Hv@kili
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c