Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757015Ab3IKTDc (ORCPT ); Wed, 11 Sep 2013 15:03:32 -0400 Received: from mail-ie0-f176.google.com ([209.85.223.176]:39204 "EHLO mail-ie0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756990Ab3IKTD3 (ORCPT ); Wed, 11 Sep 2013 15:03:29 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 11 Sep 2013 15:03:29 -0400 Message-ID: Subject: Re: [PATCH] drm/msm: fix potential NULL pointer dereference From: Rob Clark To: Wei Yongjun Cc: David Airlie , yongjun_wei@trendmicro.com.cn, "dri-devel@lists.freedesktop.org" , Linux Kernel Mailing List Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1464 Lines: 39 On Wed, Sep 11, 2013 at 10:09 AM, Wei Yongjun wrote: > From: Wei Yongjun > > The dereference to 'pdata' should be moved below the NULL test. > > Signed-off-by: Wei Yongjun Acked-by: Rob Clark > --- > drivers/gpu/drm/msm/msm_gpu.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c > index e1e1ec9..6b50e6b 100644 > --- a/drivers/gpu/drm/msm/msm_gpu.c > +++ b/drivers/gpu/drm/msm/msm_gpu.c > @@ -29,13 +29,14 @@ > static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) > { > struct drm_device *dev = gpu->dev; > - struct kgsl_device_platform_data *pdata = pdev->dev.platform_data; > + struct kgsl_device_platform_data *pdata; > > if (!pdev) { > dev_err(dev->dev, "could not find dtv pdata\n"); > return; > } > > + pdata = pdev->dev.platform_data; > if (pdata->bus_scale_table) { > gpu->bsc = msm_bus_scale_register_client(pdata->bus_scale_table); > DBG("bus scale client: %08x", gpu->bsc); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/