public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd: ubi: remove unnecessary logical constraint
Date: Tue, 18 Apr 2017 06:01:07 +0200	[thread overview]
Message-ID: <58F58F83.7020400@denx.de> (raw)
In-Reply-To: <20170415142525.27402-1-xypron.glpk@gmx.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 <xypron.glpk@gmx.de>
> ---
>   cmd/ubi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

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

      parent reply	other threads:[~2017-04-18  4:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58F58F83.7020400@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox