Hello Vivek Kasireddy,
This is a semi-automatic email about new static checker warnings.
Commit ca77f27a2665 ("drm/virtio: Import prime buffers from other
devices as guest blobs") from Nov 25, 2024, leads to the following
Smatch complaint:
drivers/gpu/drm/virtio/virtgpu_prime.c:194 virtgpu_dma_buf_free_obj()
warn: variable dereferenced before check 'attach' (see line 192)
drivers/gpu/drm/virtio/virtgpu_prime.c
191 struct dma_buf_attachment *attach = obj->import_attach;
192 struct dma_resv *resv = attach->dmabuf->resv;
^^^^^^^^^^^^^^^
The patch adds an unchecked dereference
193
194 if (attach) {
^^^^^^
The older code assumes attach can be NULL
195 dma_resv_lock(resv, NULL);
196
regards,
dan carpenter