diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-05-11 07:35:28 +0000 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-06-01 09:07:03 +0200 |
commit | 087de9ed3d076d071f09b09ef77d6107c1e1df82 (patch) | |
tree | 9e46d09d423c3baf587d0de1a403b3e933e53178 /drivers/mmc/host | |
parent | ded8a5f9613dbb62cd74f9f26a9caa3193eb3764 (diff) | |
download | talos-op-linux-087de9ed3d076d071f09b09ef77d6107c1e1df82.tar.gz talos-op-linux-087de9ed3d076d071f09b09ef77d6107c1e1df82.zip |
mmc: cast unsigned int to typeof(sector_t) to avoid unexpected error
card->csd.capacity is defined as "unsigned int", and sector_t is defined as
"u64" or "unsigned long" (depends on CONFIG_LBDAF). Thus, sector_t data
might have strange data (see below). This patch cast it to typeof(sector_t)
Special thanks to coverity <http://www.coverity.com>
ex) if sector_t was u64
unsigned int data;
sector_t sector;
data = 0x800000;
sector = (data << 8); // 0xffffffff80000000
sector = (((typeof(sector_t))data) << 8); // 0x80000000
or
data = 0x80000000;
sector = (data << 8); // 0x0
sector = (((typeof(sector_t))data) << 8); // 0x8000000000
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host')
0 files changed, 0 insertions, 0 deletions