summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2017-06-25 20:22:57 +0200
committerBrian Norris <computersforpeace@gmail.com>2017-07-08 02:57:59 +0200
commitb9504247a6eb2bd68e3f620ca1f3fbe7309123ea (patch)
tree823b3a82ef5d9a6ab5cd2b0779779b373719d009 /drivers/mtd
parentmtd: partitions: fixup some allocate_partition() whitespace (diff)
downloadlinux-b9504247a6eb2bd68e3f620ca1f3fbe7309123ea.tar.xz
linux-b9504247a6eb2bd68e3f620ca1f3fbe7309123ea.zip
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@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdcore.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 1517da3ddd7d..956382cea256 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;