From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Wed, 20 Jan 2021 16:46:38 -0500 Subject: [PATCH 2/4] fs: btrfs: volumes: prevent overflow for multiplying In-Reply-To: <20201031010752.23974-3-wqu@suse.com> References: <20201031010752.23974-1-wqu@suse.com> <20201031010752.23974-3-wqu@suse.com> Message-ID: <20210120214638.GC9782@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, Oct 31, 2020 at 09:07:50AM +0800, Qu Wenruo wrote: > In __btrfs_map_block() we do a int * int and assign it to u64. > This is not safe as the result (int * int) is still evaluated as (int) > thus it can overflow. > > Convert one of the multiplier to u64 to prevent such problem. > > In real world, this should not cause problem as we have device number > limit thus it won't go beyond 4G for a single stripe. > > But it's harder to teach coverity about all these hidden limits, so just > fix the possible overflow. > > Reported-by: Coverity CID 312957 > Reported-by: Coverity CID 312948 > Signed-off-by: Qu Wenruo Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: