1
0
Fork 0

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>
hifive-unleashed-5.1
Boris Brezillon 2017-06-25 20:22:57 +02:00 committed by Brian Norris
parent c169e3d3c0
commit b9504247a6
1 changed files with 1 additions and 1 deletions

View 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;