This is a note to let you know that I've just added the patch titled drm/virtio: Fix error code in virtio_gpu_object_shmem_init() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-virtio-fix-error-code-in-virtio_gpu_object_shmem_init.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From harshit.m.mogalapalli@xxxxxxxxxx Fri Mar 10 13:05:31 2023 From: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx> Date: Thu, 2 Mar 2023 09:28:16 -0800 Subject: drm/virtio: Fix error code in virtio_gpu_object_shmem_init() To: dmitry.osipenko@xxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx Cc: kraxel@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, emil.l.velikov@xxxxxxxxx, airlied@xxxxxxxx, error27@xxxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, darren.kenny@xxxxxxxxxx, vegard.nossum@xxxxxxxxxx, Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx> Message-ID: <20230302172816.3508816-1-harshit.m.mogalapalli@xxxxxxxxxx> From: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx> In virtio_gpu_object_shmem_init() we are passing NULL to PTR_ERR, which is returning 0/success. Fix this by storing error value in 'ret' variable before assigning shmem->pages to NULL. Found using static analysis with Smatch. Fixes: 64b88afbd92f ("drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/virtio/virtgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -159,8 +159,9 @@ static int virtio_gpu_object_shmem_init( shmem->pages = drm_gem_shmem_get_sg_table(&bo->base.base); if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base.base); + ret = PTR_ERR(shmem->pages); shmem->pages = NULL; - return PTR_ERR(shmem->pages); + return ret; } if (use_dma_api) { Patches currently in stable-queue which might be from harshit.m.mogalapalli@xxxxxxxxxx are queue-5.10/drm-virtio-fix-error-code-in-virtio_gpu_object_shmem_init.patch queue-5.10/iio-accel-mma9551_core-prevent-uninitialized-variabl.patch-4278 queue-5.10/iio-accel-mma9551_core-prevent-uninitialized-variabl.patch