Patchwork Suggested patch: reset errno after isatty()

login
register
mail settings
Submitter Ketil Froyn
Date Nov. 24, 2010, 2:30 p.m.
Message ID <AANLkTinTpe=niqS87JRR4h53TJ803ohs3e2MwiVFstgR@mail.gmail.com>
Download mbox | patch
Permalink /patch/72895/
State New
Headers show

Comments

Ketil Froyn - Nov. 24, 2010, 2:30 p.m.
On Wed, Nov 24, 2010 at 3:12 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
>
> So it dies very soon. You should easily find the line of code where this
> happens with gdb. Just compile nanddump with -g -O0

It's just that I have limited tools on my device where this happens.
But I've finally pinned it!

There's a couple of issues, I guess. Firstly, calling mtd_read_oob()
with an oob_size of 0 segfaults, which I guess it shouldn't. I haven't
looked into that. The problem here was that the oob_size was set to 0,
and that happens because the legacy code forgot to set it. This patch
fixes it for me:

                errmsg("mtd%d (%s) has insane min. I/O unit size %d",


Cheers, Ketil
Mike Frysinger - Nov. 24, 2010, 9:36 p.m.
On Wed, Nov 24, 2010 at 09:30, Ketil Froyn wrote:
> On Wed, Nov 24, 2010 at 3:12 PM, Artem Bityutskiy wrote:
>>
>> So it dies very soon. You should easily find the line of code where this
>> happens with gdb. Just compile nanddump with -g -O0
>
> It's just that I have limited tools on my device where this happens.
> But I've finally pinned it!
>
> There's a couple of issues, I guess. Firstly, calling mtd_read_oob()
> with an oob_size of 0 segfaults, which I guess it shouldn't. I haven't
> looked into that. The problem here was that the oob_size was set to 0,
> and that happens because the legacy code forgot to set it. This patch
> fixes it for me:

awesome.  can you post your signed-off-by tag and/or a proper git patch please ?
-mike

Patch

diff --git a/lib/libmtd_legacy.c b/lib/libmtd_legacy.c
index 7488275..d6c3938 100644
--- a/lib/libmtd_legacy.c
+++ b/lib/libmtd_legacy.c
@@ -261,6 +261,7 @@  int legacy_get_dev_info(const char *node, struct
mtd_dev_info *mtd)
        mtd->size = ui.size;
        mtd->eb_size = ui.erasesize;
        mtd->min_io_size = ui.writesize;
+       mtd->oob_size = ui.oobsize;

        if (mtd->min_io_size <= 0) {