Skip to content

Commit

Permalink
drm/i915/display: fix missing null check on allocated dsb object
Browse files Browse the repository at this point in the history
Currently there is no null check for a failed memory allocation
on the dsb object and without this a null pointer dereference
error can occur. Fix this by adding a null check.

Note: added a drm_err message in keeping with the error message style
in the function.

Addresses-Coverity: ("Dereference null return")
Fixes: afeda4f ("drm/i915/dsb: Pre allocate and late cleanup of cmd buffer")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200616114221.73971-1-colin.king@canonical.com
  • Loading branch information
Colin Ian King authored and Jani Nikula committed Jun 30, 2020
1 parent 0e2feab commit 607856a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/i915/display/intel_dsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ void intel_dsb_prepare(struct intel_crtc_state *crtc_state)
return;

dsb = kmalloc(sizeof(*dsb), GFP_KERNEL);
if (!dsb) {
drm_err(&i915->drm, "DSB object creation failed\n");
return;
}

wakeref = intel_runtime_pm_get(&i915->runtime_pm);

Expand Down

0 comments on commit 607856a

Please sign in to comment.