diff options
author | Brian Norris <computersforpeace@gmail.com> | 2015-08-31 14:34:55 -0700 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-11-11 14:05:36 -0800 |
commit | ba224c47a1f71f01c0e65da85718247af91a5cc4 (patch) | |
tree | 0fd23d040bb730a529d7b4c6ab9b499bbcbc742c | |
parent | c1bda1eaf2c80388fdd959a41d9da18d437d019e (diff) |
flash_{un,}lock: don't allow "last byte + 1"
A lock/unlock/islocked ioctl() should be prevented from anything past
the last byte, inclusive. But we were doing an exclusive check.
This isn't a big deal, as the kernel MTD APIs would be guarding this
anyway, but let's do this for completeness.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | flash_unlock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/flash_unlock.c b/flash_unlock.c index 7a7a773..d775c0b 100644 --- a/flash_unlock.c +++ b/flash_unlock.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) } else { mtdLockInfo.start = 0; } - if (mtdLockInfo.start > mtdInfo.size) + if (mtdLockInfo.start >= mtdInfo.size) errmsg_die("%#x is beyond device size %#x", mtdLockInfo.start, mtdInfo.size); |