From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
linux-mtd@lists.infradead.org,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH] mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
Date: Mon, 12 Jun 2017 08:45:58 +0200 [thread overview]
Message-ID: <20170612084558.43fb1e21@bbrezillon> (raw)
In-Reply-To: <87poe9vi4b.fsf@belgarion.home>
Hi Robert,
Le Mon, 12 Jun 2017 08:24:04 +0200,
Robert Jarzmik <robert.jarzmik@free.fr> a écrit :
> Boris Brezillon <boris.brezillon@free-electrons.com> writes:
>
> > Some MTD sublayers/drivers are implementing ->_read/write_oob() and
> > providing dummy wrappers for their ->_read/write() implementations.
> > Let the core handle this case instead of duplicating the logic.
>
> Hi Boris,
>
> Unless I'm wrong, you're using mtd_oob_ops structures allocated on the
> stack. This means they are not filled with 0/NULL at initialization, and
> therefore the code is not equivalent to what was before in docg3 for example.
>
> For example, oobbuf field needs initialization. Is it taken care in the core ?
According to the C99 standard (section 6.7.8.21):
"
If there are fewer initializers in a brace-enclosed list than there are
elements or members of an aggregate, or fewer characters in a string
literal used to initialize an array of known size than there are
elements in the array, the remainder of the aggregate shall be
initialized implicitly the same as objects that have static storage
duration.
"
which should guarantee that uninitialized fields are actually set to 0,
even when the struct is allocated on the stack.
Regards,
Boris
next prev parent reply other threads:[~2017-06-12 6:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-11 20:42 [PATCH] mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing Boris Brezillon
2017-06-12 6:24 ` Robert Jarzmik
2017-06-12 6:45 ` Boris Brezillon [this message]
2017-06-13 6:24 ` Robert Jarzmik
2017-06-22 21:26 ` Brian Norris
2017-06-24 20:12 ` Boris Brezillon
2017-06-25 15:01 ` Boris Brezillon
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=20170612084558.43fb1e21@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dwmw2@infradead.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
--cc=robert.jarzmik@free.fr \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox