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>] [day] [month] [year] [list]
Message-ID: <50EADCC0.4070704@oracle.com>
Date:	Mon, 07 Jan 2013 08:33:36 -0600
From:	Dave Kleikamp <dave.kleikamp@...cle.com>
To:	Nickolai Zeldovich <nickolai@...il.mit.edu>
CC:	linux-kernel@...r.kernel.org, jfs-discussion@...ts.sourceforge.net
Subject: Re: [PATCH] jfs: avoid undefined behavior from left-shifting by 32
 bits

On 01/05/2013 01:19 PM, Nickolai Zeldovich wrote:
> Shifting a 32-bit int by 32 bits is undefined behavior in C, and
> results in different behavior on different architectures (e.g., x86
> and PowerPC).  diAlloc() in fs/jfs/jfs_imap.c computes a mask using
> 0xffffffffu<<(32-bitno), which can left-shift by 32 bits.  To avoid
> unexpected behavior, explicitly check for bitno==0 and use a 0 mask.

Thanks. Pushed to
git://github.com/kleikamp/linux-shaggy.git jfs-next

Shaggy

> 
> Signed-off-by: Nickolai Zeldovich <nickolai@...il.mit.edu>
> ---
>  fs/jfs/jfs_imap.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
> index 6ba4006..f7e042b 100644
> --- a/fs/jfs/jfs_imap.c
> +++ b/fs/jfs/jfs_imap.c
> @@ -1493,7 +1493,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
>  		/* mask any prior bits for the starting words of the
>  		 * summary map.
>  		 */
> -		mask = ONES << (EXTSPERSUM - bitno);
> +		mask = (bitno == 0) ? 0 : (ONES << (EXTSPERSUM - bitno));
>  		inosmap = le32_to_cpu(iagp->inosmap[sword]) | mask;
>  		extsmap = le32_to_cpu(iagp->extsmap[sword]) | mask;
>  
> 
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ