Commit b9504247 authored by Boris Brezillon's avatar Boris Brezillon Committed by Brian Norris

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: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent c169e3d3
...@@ -991,7 +991,7 @@ EXPORT_SYMBOL_GPL(mtd_point); ...@@ -991,7 +991,7 @@ EXPORT_SYMBOL_GPL(mtd_point);
/* We probably shouldn't allow XIP if the unpoint isn't a NULL */ /* 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) int mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
{ {
if (!mtd->_point) if (!mtd->_unpoint)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (from < 0 || from >= mtd->size || len > mtd->size - from) if (from < 0 || from >= mtd->size || len > mtd->size - from)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment