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:   Mon, 4 Mar 2019 20:26:25 -0800
From:   Matthew Wilcox <willy@...radead.org>
To:     Hongbo Yao <yaohongbo@...wei.com>
Cc:     viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, linuxarm@...wei.com
Subject: Re: [PATCH] fs: Avoid signed overflow UBSAN warning

On Sat, Feb 23, 2019 at 05:02:10PM +0800, Hongbo Yao wrote:
> I ran into this:
> 	UBSAN: Undefined behaviour in fs/read_write.c:251:11
> 	signed integer overflow:
> 	9223372036854775805 + 9223372036854775805 cannot be represented in
> 	type 'long long int'
> 
> Use unsigned types to do math, it doesn't throw a UBSAN warning
> when it does overflow.This patch doesn't change generated code.

You don't need to be this verbose to fix it.

> -			offset += file->f_pos;
> +			offset = (u64)file->f_pos + (u64)offset;

			offset += (u64)file->f_pos;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ