cmd: ubi: remove unnecessary logical constraint
PATCH 1/1 cmd: ubi: remove unnecessary logical constraint
A size_t variable can never be negative.
The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>
--- cmd/ubi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/ubi.c +1 -1
@@ -308,7 +308,7 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size,return ENODEV ; 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" );return EINVAL ; }
Signature · 1 line
2.11.0
PATCH 1/1 cmd: ubi: remove unnecessary logical constraint
Quoted 5 lines · Heinrich Schuchardt
A
size_tvariable can never be negative.The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>
Reviewed-by Tom Rini <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170415/867b3de7/attachment.sig>
PATCH 1/1 cmd: ubi: remove unnecessary logical constraint
In reply to Heinrich SchuchardtHello Heinrih,
Am 15.04.2017 um 16:25 schrieb Heinrich Schuchardt:
Quoted 8 lines
A
size_tvariable can never be negative.The problem was indicated by cppcheck.
Signed-off-by Heinrich Schuchardt <[email protected]>--- cmd/ubi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Heiko Schocher <[email protected]>
bye,
Heiko
Quoted 15 lines
cmd/ubi.c +1
-1@@ -308,7 +308,7 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size,return ENODEV ; 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" );return EINVAL ; }
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany