mtd: Fix check in mtd_unpoint()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jul 13 10:59:06 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=b9504247a6eb2bd68e3f620ca1f3fbe7309123ea
Commit:     b9504247a6eb2bd68e3f620ca1f3fbe7309123ea
Parent:     c169e3d3c049d93929a92f909a4b80ba0f85a3c3
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Sun Jun 25 20:22:57 2017 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Jul 7 17:57:59 2017 -0700

    mtd: Fix check in mtd_unpoint()
    
    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 at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 1517da3..956382c 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -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;



More information about the linux-mtd-cvs mailing list