possible unintended integer truncation in fs/ext4/extents.c:get_implied_cluster_alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello folks,

while running a simple analyzer plugin on linux 3.12.5 written by Emese Revfy
we found a case in ext4 that looks like a potential problem. the code looks
like this:

4082 		map->m_pblk = (ee_start & ~(sbi->s_cluster_ratio - 1)) +
4083 			c_offset;

here the expression ~(sbi->s_cluster_ratio - 1) will first do the negation
on an unsigned int then extend the result to unsigned long long (i.e, there's
a 32->64 bit conversion on both 32 and 64 bit archs) and stores it as such.
now this will obviously lose the higher 32 bits of ee_start and the question
is: is this intended behaviour or a bug? later the code compares map->m_pblk
against ee_block which is as unsigned int only so there's some mixture of
integer types here that may warrant further review.

cheers,
 PaX Team

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux