public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: [smatch stuff] mtd/ubi/gluebi: signedness warnings
Date: Mon, 10 Oct 2011 12:28:57 +0300	[thread overview]
Message-ID: <20111010092857.GA16165@elgon.mountain> (raw)

Smatch complains about some to the checks in gluebi.c

drivers/mtd/ubi/gluebi.c +177 gluebi_read(6) warn: unsigned 'len' is never less than zero.
drivers/mtd/ubi/gluebi.c +221 gluebi_write(6) warn: unsigned 'len' is never less than zero.
drivers/mtd/ubi/gluebi.c +270 gluebi_erase(7) warn: unsigned 'instr->len' is never less than zero.

I think probably these checks can just be removed?  Can these things
wrap if we passed a huge value for instr->len?

   270          if (instr->len < 0 || instr->addr + instr->len > mtd->size)
   271                  return -EINVAL;

I don't know enough about how these are called to say.

regards,
dan carpenter

             reply	other threads:[~2011-10-10  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10  9:28 Dan Carpenter [this message]
2011-10-14  9:42 ` [smatch stuff] mtd/ubi/gluebi: signedness warnings Artem Bityutskiy

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=20111010092857.GA16165@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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