All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: [bug report] UBIFS: add new flash file system
Date: Tue, 21 Feb 2017 21:23:44 +0300	[thread overview]
Message-ID: <20170221182344.GA28595@mwanda> (raw)

Hello Artem Bityutskiy,

The patch 1e51764a3c2a: "UBIFS: add new flash file system" from Jul
14, 2008, leads to the following static checker warning:

	fs/ubifs/sb.c:408 validate_sb()
	warn: we tested 'c->main_lebs < (3 + 6)' before and it was 'false'

fs/ubifs/sb.c
   380          if (c->log_lebs < UBIFS_MIN_LOG_LEBS ||
   381              c->lpt_lebs < UBIFS_MIN_LPT_LEBS ||
   382              c->orph_lebs < UBIFS_MIN_ORPH_LEBS ||
   383              c->main_lebs < UBIFS_MIN_MAIN_LEBS) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We should delete this right?

   384                  err = 4;
   385                  goto failed;
   386          }
   387  
   388          /*
   389           * Calculate minimum allowed amount of main area LEBs. This is very
   390           * similar to %UBIFS_MIN_LEB_CNT, but we take into account real what we
   391           * have just read from the superblock.
   392           */
   393          min_leb_cnt = UBIFS_SB_LEBS + UBIFS_MST_LEBS + c->log_lebs;
   394          min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6;
   395  
   396          if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) {
   397                  ubifs_err(c, "bad LEB count: %d in superblock, %d on UBI volume, %d minimum required",
   398                            c->leb_cnt, c->vi.size, min_leb_cnt);
   399                  goto failed;
   400          }
   401  
   402          if (c->max_leb_cnt < c->leb_cnt) {
   403                  ubifs_err(c, "max. LEB count %d less than LEB count %d",
   404                            c->max_leb_cnt, c->leb_cnt);
   405                  goto failed;
   406          }
   407  
   408          if (c->main_lebs < UBIFS_MIN_MAIN_LEBS) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Because this is a duplicate, except we don't set "err = 4".

   409                  ubifs_err(c, "too few main LEBs count %d, must be at least %d",
   410                            c->main_lebs, UBIFS_MIN_MAIN_LEBS);
   411                  goto failed;
   412          }

regards,
dan carpenter

                 reply	other threads:[~2017-02-21 18:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170221182344.GA28595@mwanda \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.