mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Yann Sionneau <ysionneau@kalray.eu>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mci: fix wrong sd/mmc/emmc card size computation for arch where char is signed
Date: Tue, 15 Sep 2020 09:33:26 +0200	[thread overview]
Message-ID: <20200915073326.GE4498@pengutronix.de> (raw)
In-Reply-To: <20200914160208.14747-1-ysionneau@kalray.eu>

On Mon, Sep 14, 2020 at 06:02:08PM +0200, Yann Sionneau wrote:
> char type can be either signed or unsigned according to C standard.
> If your arch has signed char, this kind of computation will end up wrong
> because of sign extension:
> 
> https://git.pengutronix.de/cgit/barebox/tree/drivers/mci/mci-core.c#n869
> 
> mci->capacity = mci->ext_csd[EXT_CSD_SEC_COUNT] << 0 |
> 		mci->ext_csd[EXT_CSD_SEC_COUNT + 1] << 8 |
> 		mci->ext_csd[EXT_CSD_SEC_COUNT + 2] << 16 |
> 		mci->ext_csd[EXT_CSD_SEC_COUNT + 3] << 24;
> 
> Turning the ext_csd field into u8 * fixes the issue.
> 
> Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
> ---
>  include/mci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-09-15  7:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 16:02 Yann Sionneau
2020-09-15  7:33 ` Sascha Hauer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-14 15:27 Yann Sionneau
2020-09-14 15:51 ` Ahmad Fatoum
2020-09-14 16:03   ` Yann Sionneau

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=20200915073326.GE4498@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ysionneau@kalray.eu \
    /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