]> Git Repo - linux.git/commitdiff
virtio-gpu: avoid possible NULL pointer dereference
authorHeinrich Schuchardt <[email protected]>
Sun, 21 Aug 2016 21:06:06 +0000 (23:06 +0200)
committerGerd Hoffmann <[email protected]>
Tue, 20 Sep 2016 12:25:39 +0000 (14:25 +0200)
If output is NULL it is not permissable to dereference it.
So we should leave the respective function in this case.

The inconsistency was indicated by cppcheck.
No actual NULL pointer dereference was observed.

Signed-off-by: Heinrich Schuchardt <[email protected]>
Message-id: 1471813566[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
drivers/gpu/drm/virtio/virtgpu_plane.c

index 925ca25209dfa12a60128b333d21d19fad9c03af..ba28c0f6f28a352b3f6f030b09be90d76eca6cec 100644 (file)
@@ -76,7 +76,8 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
                output = drm_crtc_to_virtio_gpu_output(plane->state->crtc);
        if (old_state->crtc)
                output = drm_crtc_to_virtio_gpu_output(old_state->crtc);
-       WARN_ON(!output);
+       if (WARN_ON(!output))
+               return;
 
        if (plane->state->fb) {
                vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
@@ -129,7 +130,8 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
                output = drm_crtc_to_virtio_gpu_output(plane->state->crtc);
        if (old_state->crtc)
                output = drm_crtc_to_virtio_gpu_output(old_state->crtc);
-       WARN_ON(!output);
+       if (WARN_ON(!output))
+               return;
 
        if (plane->state->fb) {
                vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
This page took 0.057768 seconds and 4 git commands to generate.