All of lore.kernel.org
 help / color / mirror / Atom feed
From: hujianyang <hujianyang@huawei.com>
To: Artem Bityutskiy <dedekind1@gmail.com>,
	Brian Norris <computersforpeace@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: Report: mtd-utils: "Floating point exception" with ubiformat
Date: Fri, 31 Oct 2014 18:36:42 +0800	[thread overview]
Message-ID: <5453663A.8080608@huawei.com> (raw)

Hi,

Here is an interesting problem. I used a nand flash driver with
wrong partition table and an error like this occurred:

# insmod nandflash.ko

[454096.098834] mtd: partition "ubi1" is out of reach -- disabled


The display of /proc/mtd shows the size of mtd1 is zero:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubi0"
mtd1: 00000000 00000000 "ubi1"
mtd2: 20000000 00020000 "rest"


When performing ubiformat with this mtd1, the utility breaks
down with a message:

# ubiformat /dev/mtd1
Floating point exception


I used to think it is because ubiformat can't deal with a zero
size MTD device. So I want to add something like a error branch
for this. But now I find it is because the "erasesize" in
"/sys/class/mtd/mtd1" is zero.

:/sys/class/mtd/mtd1# cat erasesize
0

So function mtd_get_dev_info1() in lib/libmtd.c, line 777

"""
mtd->eb_cnt = mtd->size / mtd->eb_size;
"""

will crash the program because mtd->eb_size is zero.


Do you think it is a valuable problem to deal with? Keep the
existing logic is OK. But can we add something in mtd-utils
to indicate this error than "Floating point exception"?


Thanks~!

Hu

             reply	other threads:[~2014-10-31 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 10:36 hujianyang [this message]
2014-11-07  9:43 ` Report: mtd-utils: "Floating point exception" with ubiformat Artem Bityutskiy
2014-11-07 10:03   ` hujianyang
2014-11-07 10:06     ` 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=5453663A.8080608@huawei.com \
    --to=hujianyang@huawei.com \
    --cc=computersforpeace@gmail.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.