Skip to content
Snippets Groups Projects
Commit 18f41f2f authored by xypron.glpk@gmx.de's avatar xypron.glpk@gmx.de Committed by Heiko Schocher
Browse files

cmd: ubi: remove unnecessary logical constraint


A size_t variable can never be negative.

The problem was indicated by cppcheck.

Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: default avatarTom Rini <trini@konsulko.com>
Reviewed-by: default avatarHeiko Schocher <hs@denx.de>
parent f6c1df44
No related branches found
No related tags found
No related merge requests found
...@@ -308,7 +308,7 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size, ...@@ -308,7 +308,7 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size,
return ENODEV; return ENODEV;
rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad); rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad);
if (size < 0 || size > rsvd_bytes) { if (size > rsvd_bytes) {
printf("size > volume size! Aborting!\n"); printf("size > volume size! Aborting!\n");
return EINVAL; return EINVAL;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment