From mboxrd@z Thu Jan 1 00:00:00 1970 From: Inki Dae Subject: RE: [PATCH 1/1] drm/exynos: Fix potential NULL pointer dereference in exynos_drm_encoder.c Date: Thu, 22 Nov 2012 17:26:02 +0900 Message-ID: <024e01cdc88b$02636490$072a2db0$%dae@samsung.com> References: <1353316830-23755-1-git-send-email-sachin.kamat@linaro.org> <06ae01cdc63a$8a01f7c0$9e05e740$%dae@samsung.com> <06b101cdc63c$c1135720$433a0560$%dae@samsung.com> <024001cdc888$e9d80bd0$bd882370$%dae@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id E4CC6E5C12 for ; Thu, 22 Nov 2012 00:26:06 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDV00HOBRD0IY40@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 22 Nov 2012 17:26:05 +0900 (KST) Received: from NOINKIDAE02 ([10.90.51.52]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDV009M6RFFWB60@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 22 Nov 2012 17:26:03 +0900 (KST) In-reply-to: Content-language: ko List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: 'Sachin Kamat' Cc: dri-devel@lists.freedesktop.org, patches@linaro.org List-Id: dri-devel@lists.freedesktop.org > -----Original Message----- > From: Sachin Kamat [mailto:sachin.kamat@linaro.org] > Sent: Thursday, November 22, 2012 5:19 PM > To: Inki Dae > Cc: dri-devel@lists.freedesktop.org; jy0922.shim@samsung.com; > patches@linaro.org > Subject: Re: [PATCH 1/1] drm/exynos: Fix potential NULL pointer > dereference in exynos_drm_encoder.c > > [snip] > >> >> And NULL pointer checking was already done above like below, > >> >> if (overlay_ops && overlay_ops->disable) > >> >> overlay_ops->disable(manager->dev, zpos); > >> > Correct. But that check is applicable only for that one statement > >> > (overlay_ops->disable(manager->dev, zpos);). > >> > > >> > Similar check needs to be added to below 'if' code too. > >> > >> What are your comments about this? > >> > > > > Left condition first is checked so as I mentioned before, it doesn't > need > > overlay_ops checking because that was checked already. why do you think > > overlay_ops should be checked again? > > > > Consider the case when overlay_ops is NULL. > > if (overlay_ops && overlay_ops->disable) > overlay_ops->disable(manager->dev, zpos); > > It does not enter this condition as overlay_ops is NULL and moves to > the next statement, > if (overlay_ops->wait_for_vblank) where it gets dereferenced. > > Please note we are not returning back from the first condition if > overlay_ops is NULL. > Hence we need to check the condition in second case too. > Ah~ Right. I didn't check it surely. :) Thanks, Inki Dae > -- > With warm regards, > Sachin