Understanding OOB data read implementation (II)

David Peverley pev at sketchymonkey.com
Fri Oct 15 07:29:48 EDT 2010


Hi again...!

I've also noticed after blindly copying it that in the DoC drivers
that the OOB reads use the ops->len for size :
    static int doc_read_oob(struct mtd_info *mtd, loff_t ofs,
                            struct mtd_oob_ops *ops)
        ...
        uint8_t *buf = ops->oobbuf;
        size_t len = ops->len;
        ...

Reading mtd.h and the following patch summary :
    http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg03799.html

I suspect this is wrong and should be using ops->ooblen instead. This
is especially true given that mtdchar.c leaves ops->len
uninitialised....! (should mtdchar.c:mtd_do_readoob() not zero the ops
structure as it's a local automatic so not zero-initialised?) Again
this is copied in doc2001.c and doc2001plus.c.

Cheers,

~Pev



More information about the linux-mtd mailing list