public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] mfd: sta2x11-mfd: fix potential NULL pointer dereference in __sta2x11_mfd_mask()
@ 2012-12-02 13:33 Wei Yongjun
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Yongjun @ 2012-12-02 13:33 UTC (permalink / raw)
  To: sameo; +Cc: yongjun_wei, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference to 'mfd' should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/mfd/sta2x11-mfd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
index 012a521..1ecbdfb 100644
--- a/drivers/mfd/sta2x11-mfd.c
+++ b/drivers/mfd/sta2x11-mfd.c
@@ -116,12 +116,14 @@ u32 __sta2x11_mfd_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val,
 	struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev);
 	u32 r;
 	unsigned long flags;
-	void __iomem *regs = mfd->regs[index];
+	void __iomem *regs;
 
 	if (!mfd) {
 		dev_warn(&pdev->dev, ": can't access sctl regs\n");
 		return 0;
 	}
+
+	regs = mfd->regs[index];
 	if (!regs) {
 		dev_warn(&pdev->dev, ": system ctl not initialized\n");
 		return 0;



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH -next] mfd: sta2x11-mfd: fix potential NULL pointer dereference in __sta2x11_mfd_mask()
@ 2012-12-02 13:36 Wei Yongjun
  2012-12-02 23:47 ` Samuel Ortiz
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2012-12-02 13:36 UTC (permalink / raw)
  To: sameo; +Cc: yongjun_wei, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference to 'mfd' should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/mfd/sta2x11-mfd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
index 012a521..1ecbdfb 100644
--- a/drivers/mfd/sta2x11-mfd.c
+++ b/drivers/mfd/sta2x11-mfd.c
@@ -116,12 +116,14 @@ u32 __sta2x11_mfd_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val,
 	struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev);
 	u32 r;
 	unsigned long flags;
-	void __iomem *regs = mfd->regs[index];
+	void __iomem *regs;
 
 	if (!mfd) {
 		dev_warn(&pdev->dev, ": can't access sctl regs\n");
 		return 0;
 	}
+
+	regs = mfd->regs[index];
 	if (!regs) {
 		dev_warn(&pdev->dev, ": system ctl not initialized\n");
 		return 0;



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mfd: sta2x11-mfd: fix potential NULL pointer dereference in __sta2x11_mfd_mask()
  2012-12-02 13:36 [PATCH -next] mfd: sta2x11-mfd: fix potential NULL pointer dereference in __sta2x11_mfd_mask() Wei Yongjun
@ 2012-12-02 23:47 ` Samuel Ortiz
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2012-12-02 23:47 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: yongjun_wei, linux-kernel

Hi Wei,

On Sun, Dec 02, 2012 at 08:36:22AM -0500, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The dereference to 'mfd' should be moved below the NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/mfd/sta2x11-mfd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
Patch applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-02 23:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-02 13:36 [PATCH -next] mfd: sta2x11-mfd: fix potential NULL pointer dereference in __sta2x11_mfd_mask() Wei Yongjun
2012-12-02 23:47 ` Samuel Ortiz
  -- strict thread matches above, loose matches on Subject: below --
2012-12-02 13:33 Wei Yongjun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox