public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: ubi: remove unnecessary logical constraint
@ 2017-04-15 14:25 Heinrich Schuchardt
  2017-04-15 16:12 ` Tom Rini
  2017-04-18  4:01 ` Heiko Schocher
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2017-04-15 14:25 UTC (permalink / raw)
  To: u-boot

A size_t variable can never be negative.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 cmd/ubi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index efc43ffde9..222be5a357 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -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;
 	}
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-18  4:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-15 14:25 [U-Boot] [PATCH] cmd: ubi: remove unnecessary logical constraint Heinrich Schuchardt
2017-04-15 16:12 ` Tom Rini
2017-04-18  4:01 ` Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox