lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 8 Apr 2015 09:14:46 +0000
From:	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To:	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
CC:	Ulf Hansson <ulf.hansson@...aro.org>,
	<ryusuke.sakato.bx@...esas.com>,
	<yoshihiro.shimoda.uh@...esas.com>,
	<hiroyuki.yokoyama.vx@...esas.com>,
	<takeshi.kihara.df@...esas.com>,
	"Jaehoon Chung" <jh80.chung@...sung.com>,
	Chris Ball <chris@...ntf.net>,
	Seungwon Jeon <tgih.jun@...sung.com>,
	"Grégory Soutadé" <gsoutade@...tion.com>,
	<linux-kernel@...r.kernel.org>, <linux-mmc@...r.kernel.org>
Subject: Re: [PATCH 2/2][RFC] mmc: cast unsigned int to typeof(sector_t) to avoid unexpected error

Hi

> card->csd.capacity is defined as "unsigned int",
> and, sector_t is defined as "u64" or "unsigned long" (depends on CONFIG_LBDAF)
> sector_t data might have strange data if first bit of unsigned int
> was 1. this patch cast it to typeof(sector_t)
> 
> ex) if sector_t was u64
> 
>         unsigned int data;
>         sector_t sector;
> 
>         data = 0x80000000;
>         sector = (data << 8); // 0xffffff8000000000
>         sector = (((typeof(sector_t))data) << 8); // 0x8000000000

Sorry, I noticed this explain (= number of 0) was wrong
Maybe it should be

         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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists