From: Artem Bityutskiy <dedekind1@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [bug reportish] UBI_MAX_ERASECOUNTER not used consistently
Date: Thu, 11 Oct 2012 17:33:05 +0300 [thread overview]
Message-ID: <1349965985.12014.16.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <20121005065704.GA26466@elgon.mountain>
[-- Attachment #1: Type: text/plain, Size: 981 bytes --]
On Fri, 2012-10-05 at 09:57 +0300, Dan Carpenter wrote:
> Hi Artem,
>
> I normally audit for underflows and I had a question about this code.
>
> mtd/ubi/attach.c
> 665 static int early_erase_peb(struct ubi_device *ubi,
> 666 const struct ubi_attach_info *ai, int pnum, int ec)
> 667 {
> 668 int err;
> 669 struct ubi_ec_hdr *ec_hdr;
> 670
> 671 if ((long long)ec >= UBI_MAX_ERASECOUNTER) {
>
> Casting to long long doesn't serve any purpose. We normally say that
> "> UBI_MAX_ERASECOUNTER" is invalid but "== UBI_MAX_ERASECOUNTER" is Ok.
> The "ec" variable is signed and negative values are missed on this
> check.
Yes, the cast is bogus. I can fix it by removing the cast, but would
like to give you a chance to send the patch so that you get the credit
being the author in the git history. Let me know what you prefer.
Thanks!
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2012-10-11 14:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 6:57 [bug reportish] UBI_MAX_ERASECOUNTER not used consistently Dan Carpenter
2012-10-11 14:33 ` Artem Bityutskiy [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=1349965985.12014.16.camel@sauron.fi.intel.com \
--to=dedekind1@gmail.com \
--cc=dan.carpenter@oracle.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