]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: Fix check in mtd_unpoint()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Sun, 25 Jun 2017 18:22:57 +0000 (20:22 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Sat, 8 Jul 2017 00:57:59 +0000 (17:57 -0700)
The code checks that ->_point is not NULL, but we should actually check
->_unpoint value which is dereferenced a few lines after the check.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/mtdcore.c

index 1517da3ddd7d0b9752f8b7d4ebea8aaa3a6ae298..956382cea2568b3ee9c8721e5ab2acd522ce66f5 100644 (file)
@@ -991,7 +991,7 @@ EXPORT_SYMBOL_GPL(mtd_point);
 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
 int mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
 {
-       if (!mtd->_point)
+       if (!mtd->_unpoint)
                return -EOPNOTSUPP;
        if (from < 0 || from >= mtd->size || len > mtd->size - from)
                return -EINVAL;