From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Tue, 18 Apr 2017 06:01:07 +0200 Subject: [U-Boot] [PATCH] cmd: ubi: remove unnecessary logical constraint In-Reply-To: <20170415142525.27402-1-xypron.glpk@gmx.de> References: <20170415142525.27402-1-xypron.glpk@gmx.de> Message-ID: <58F58F83.7020400@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Heinrih, Am 15.04.2017 um 16:25 schrieb Heinrich Schuchardt: > A size_t variable can never be negative. > > The problem was indicated by cppcheck. > > Signed-off-by: Heinrich Schuchardt > --- > cmd/ubi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Heiko Schocher bye, Heiko > > 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; > } > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany