]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: cast u8 to unsigned long long to avoid unexpected error
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 11 May 2015 07:34:53 +0000 (07:34 +0000)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Jun 2015 07:07:03 +0000 (09:07 +0200)
commit7ac448f6b4218316d08f5cb4eb2a4be9714ab388
tree4a09968f8470b96b0d71251e46841bfa80e5da89
parentb2b8a988680799c39837cee7cd974194ed04ca01
mmc: cast u8 to unsigned long long to avoid unexpected error

card->ext_csd.enhanced_area_offset is defined as "unsigned long long",
and, ext_csd[] is defined as u8.
unsigned long long data might have strange data if first bit of ext_csd[]
was 1. this patch cast it to (unsigned long long)
Special thanks to coverity <http://www.coverity.com>

ex)
        u8  data8;
        u64 data64;

        data8 = 0x80;
        data64 = (data8 << 24); // 0xffffffff80000000
        data64 = (((unsigned long long)data8) << 24); // 0x80000000;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/mmc.c