All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] UBIFS: add new flash file system
@ 2017-02-21 18:23 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-02-21 18:23 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-21 18:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-21 18:23 [bug report] UBIFS: add new flash file system Dan Carpenter

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.