mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Apr 5 02:59:02 EDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c69dbbf3335a21aae74376d7e5db50a486d52439
Commit:     c69dbbf3335a21aae74376d7e5db50a486d52439
Parent:     ffdac6cdd9f4c561fc49192c1ea1570f475659e9
Author:     Dan Carpenter <dan.carpenter at oracle.com>
AuthorDate: Mon Feb 17 23:03:08 2014 +0300
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Mar 10 22:42:27 2014 -0700

    mtd: nuc900_nand: NULL dereference in nuc900_nand_enable()
    
    Instead of writing to "nand->reg + REG_FMICSR" we write to "REG_FMICSR"
    which is NULL and not a valid register.
    
    Fixes: 8bff82cbc308 ('mtd: add nand support for w90p910 (v2)')
    Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/nuc900_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nuc900_nand.c b/drivers/mtd/nand/nuc900_nand.c
index 331fccb..e8a5fff 100644
--- a/drivers/mtd/nand/nuc900_nand.c
+++ b/drivers/mtd/nand/nuc900_nand.c
@@ -225,7 +225,7 @@ static void nuc900_nand_enable(struct nuc900_nand *nand)
 	val = __raw_readl(nand->reg + REG_FMICSR);
 
 	if (!(val & NAND_EN))
-		__raw_writel(val | NAND_EN, REG_FMICSR);
+		__raw_writel(val | NAND_EN, nand->reg + REG_FMICSR);
 
 	val = __raw_readl(nand->reg + REG_SMCSR);
 



More information about the linux-mtd-cvs mailing list