Fix off-by-one errors

Fixed identical off-by-one errors in blockdevice read function and in
linux posix file driver.
rtxlink
Niccolò Izzo 2023-12-21 09:50:41 +01:00 zatwierdzone przez Silvano Seva
rodzic 1122cae2fd
commit c29f271f96
2 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -37,7 +37,7 @@
static inline bool checkBounds(const struct nvmArea *area, uint32_t addr, size_t len)
{
return (addr >= area->startAddr)
&& ((addr + len) < (area->startAddr + area->size));
&& ((addr + len) <= (area->startAddr + area->size));
}

Wyświetl plik

@ -87,7 +87,7 @@ static int nvm_api_read(const struct nvmDevice *dev, uint32_t offset,
if(fd < 0)
return -EBADF;
if((offset + len) >= cfg->fileSize)
if((offset + len) > cfg->fileSize)
return -EINVAL;
lseek(fd, offset, SEEK_SET);