From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] mci: Do not access ext_csd on SD cards
Date: Mon, 24 Mar 2025 09:19:39 +0100 [thread overview]
Message-ID: <Z-EVm4bn5kCxlaz3@pengutronix.de> (raw)
In-Reply-To: <20250324081415.1697333-1-s.hauer@pengutronix.de>
On Mon, Mar 24, 2025 at 09:14:15AM +0100, Sascha Hauer wrote:
> SD cards do not have a ext_csd so accessing it on an SD card results in
> a NULL pointer derefence. Move the production year check to
> mci_mmc_decode_cid() which is executed for MMC devices only. While at
> it do not access ext_csd directly. We have already populated
> mci->version, so use this to check for the MMC versions which need the
> production year adjustment.
>
> Fixes: a4a78c4f32 ("mci: use struct cid")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/mci/mci-core.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index c89322f61e..1e49969017 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -2377,6 +2377,12 @@ static int mci_mmc_decode_cid(struct mci *card)
> return -EINVAL;
> }
>
> + if (mci->version >= MMC_VERSION_4_41) {
> + /* Adjust production date as per JEDEC JESD84-B451 */
> + if (mci->cid.year < 2010)
> + mci->cid.year += 16;
> + }
The variable is named "card" in this function, not "mci". Will fix while
applying.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-03-24 8:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 8:14 Sascha Hauer
2025-03-24 8:19 ` Sascha Hauer [this message]
2025-03-24 8:21 ` Sascha Hauer
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=Z-EVm4bn5kCxlaz3@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox