If the file contains only a few bytes in the last page and the
--oob option is selected, the loop may exit early
(readlen < meminfo.oobsize).
Most of the time it will still work though because the code
tries to read the whole OOB in one chunk.
Signed-off-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
if (writeoob) {
int tinycnt = 0;
- while(tinycnt < readlen) {
+ while(tinycnt < meminfo.oobsize) {
cnt = read(ifd, oobreadbuf + tinycnt, meminfo.oobsize - tinycnt);
if (cnt == 0) { // EOF
break;