summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/gma500
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2018-06-25 15:18:44 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-06-26 16:23:46 +0300
commit80c18ba11a7a84cb97e39e5c9b6cdeee9f3c0728 (patch)
tree4d4831d233247f6b92abfad87d333ba8b473558a /drivers/gpu/drm/gma500
parenta63d3bd230772b307c6595469e615d44a1dacdab (diff)
downloadlinux-80c18ba11a7a84cb97e39e5c9b6cdeee9f3c0728.tar.xz
drm/gma500: Fix potential NULL pointer dereference
fb is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after fb has been properly null checked at line 74: if (!fb) Addresses-Coverity-ID: 1470169 ("Dereference before null check") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180625121844.GA12466@embeddedor.com
Diffstat (limited to 'drivers/gpu/drm/gma500')
-rw-r--r--drivers/gpu/drm/gma500/gma_display.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
index 015dc9f9348d..08f17f85b801 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -60,7 +60,7 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
struct drm_psb_private *dev_priv = dev->dev_private;
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
struct drm_framebuffer *fb = crtc->primary->fb;
- struct gtt_range *gtt = to_gtt_range(fb->obj[0]);
+ struct gtt_range *gtt;
int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe];
unsigned long start, offset;
@@ -76,6 +76,8 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
goto gma_pipe_cleaner;
}
+ gtt = to_gtt_range(fb->obj[0]);
+
/* We are displaying this buffer, make sure it is actually loaded
into the GTT */
ret = psb_gtt_pin(gtt);