You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Oldřich Jedlička e0ce80d42a kernel: Fix off-by-one error in FIT mtd partition search.
This fixes off-by-one error introduced in commit dc76900021
("kernel: Correctly search for the FIT image in mtd partition.")

Function `mtd_read` starts reading at `offset` and
needs `hdr_len` number of bytes to be available. Suppose
the easiest case when `offset` is `0` and `hdr_len` equals
to `mtd->size` - the `for` loop will not be entered even
when enough bytes are available to be read.

Same happens for any non-zero `offset`, when `hdr_len` is
just enough bytes to be read until `mtd->size` is reached.
Imagine that for example `mtd->size=5`, `offset=4` and
`hdr_len=1`. Then `offset+hdr_len=5` and the check has to
be `offset+hdr_len <= mtd->size`, i.e. `5 <= 5`. The
check for `offset + hdr_len` value needs to be inclusive,
therefore use `<=`.

Fixes: dc76900021 ("kernel: Correctly search for the FIT image in mtd partition.")
Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
[adjusted commit ref, fixes tag]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
..
Kconfig kernel: mtdsplit: Add support for D-link JBOOT 6 years ago
Makefile kernel: mtdsplit: Add support for D-link JBOOT 6 years ago
mtdsplit.c treewide: replace nbd@openwrt.org with nbd@nbd.name 8 years ago
mtdsplit.h treewide: replace nbd@openwrt.org with nbd@nbd.name 8 years ago
mtdsplit_brnimage.c kernel: update mtdsplit for linux 4.9 7 years ago
mtdsplit_eva.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_fit.c kernel: Fix off-by-one error in FIT mtd partition search. 5 years ago
mtdsplit_jimage.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_lzma.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_minor.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_seama.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_squashfs.c kernel: update mtdsplit for linux 4.9 7 years ago
mtdsplit_tplink.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_trx.c kernel: Add missing includes mtdsplit_*.c 5 years ago
mtdsplit_uimage.c kernel: mtdsplit_uimage: add support for okli image 5 years ago
mtdsplit_wrgg.c kernel: Add missing includes mtdsplit_*.c 5 years ago