Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1814215pxv; Fri, 2 Jul 2021 12:58:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9BxuqQ1iXtzRkCiBjRVHaF+Wd2BnN7HqmP7Gs02gK4p8Nq3zyAohZB2QaNMkkoqHEY7/g X-Received: by 2002:a02:9706:: with SMTP id x6mr958489jai.125.1625255934231; Fri, 02 Jul 2021 12:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625255934; cv=none; d=google.com; s=arc-20160816; b=SSmHB57OADTzTucBw6guqxWusJrPNRATCuVs3kUsi2Ta9ousjNFDhgM0oYVFZjHDnj 9pGwmdZaMGs+MLb2okSr3ArgNrGEO2hal5+HfrPIGQ4hIos5C/wD7I8alcNkz5m1WqNs c56Qf9DGMBW6h4qS1ylG75E4wA4xLU1/bmhic1+Ovk8f2LPUen3J3d12ihZfxnX7SeTC yKXwmPutotqQBGrpy6w21O4r49W/KJ5KxapmV9rhbVcHf/J65N3TR42CoD6MJTJ2TDxl rJxMpv7gfcx4stNukhNpoxctYTpLDPXVi+XfeUeciWsGiiSPzMFrbyC5qKeTimLyk1PL kbWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rd3fCmRQ3i5zSIy92WhoijXedJ4tTsSkdqIAJCX9pvk=; b=epqAMWUl3t5TyqUlMiK8wXOtIQkOZN3hUTU2X815sgBFoblyhe7zpXmJXA+QfhtCWP 34yWuzkN6gfilj3Zj32QJQBl2BgfLbEdXxj71ImcMildnBqZplk/UeKygwmp1nq9vrEp ruqWR6sG7g+UVDWgaAi1MVcr20t4lbSU3gQ71LM+JillaxueO1QDVXEMo9psAVwFmuED jeAktgugfLsedG9Bj40UhR2wv3QdSCtrdtUG1sK3lO9pd0qvH3EO5vmnpQ95V3ehac0R Ga5xoA3/Wpbd4TSRT1GyhCEt5QCvoWjUbvBqQxRUp+4GL4miJf98OApT+wGJIO3z+6Rs 3DIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kJvtVtTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si4424788ion.65.2021.07.02.12.58.42; Fri, 02 Jul 2021 12:58:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kJvtVtTI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbhGBUAs (ORCPT + 99 others); Fri, 2 Jul 2021 16:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbhGBUAs (ORCPT ); Fri, 2 Jul 2021 16:00:48 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25027C061762; Fri, 2 Jul 2021 12:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rd3fCmRQ3i5zSIy92WhoijXedJ4tTsSkdqIAJCX9pvk=; b=kJvtVtTI1FxNsAU186RY6u8++z LFbolpFVSnwqLB0ULZVvhIIDEKbgENZJiAmlG/0Wc1GhSgP0n3u3Bx+ks+7ZEw185MKR7SjDzHBwp JjuzesV7AbVOTGvAU/ZAPKQo1Mp3UjIA7H9Dk+YyrtcmU72R64dyCNwF9yY93lBkA0Iwu9QG+WDq3 pRFBt6+dpKLstUYXA71hu5Gla2NGCYhMTWB2OxrOYfR1v1toP8GWypwTHOM40PxL6sFYRTfKOCLEq dNJDxeBqff8ZKIAXRCFvcJsLqKF93xA912FKeCiZDzL7WNijJpkTxk7RILfaeN8+H7mSeIgfN5bqr LIjqWlYw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzPGv-0080GQ-IH; Fri, 02 Jul 2021 19:56:45 +0000 Date: Fri, 2 Jul 2021 20:56:21 +0100 From: Matthew Wilcox To: Zhen Lei Cc: Christoph Hellwig , "Darrick J . Wong" , linux-xfs , linux-fsdevel , linux-kernel Subject: Re: [PATCH -next 1/1] iomap: Fix a false positive of UBSAN in iomap_seek_data() Message-ID: References: <20210702092109.2601-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210702092109.2601-1-thunder.leizhen@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 02, 2021 at 05:21:09PM +0800, Zhen Lei wrote: > Move the evaluation expression "size - offset" after the "if (offset < 0)" > judgment statement to eliminate a false positive produced by the UBSAN. > > No functional changes. > > ========================================================================== > UBSAN: Undefined behaviour in fs/iomap.c:1435:9 > signed integer overflow: > 0 - -9223372036854775808 cannot be represented in type 'long long int' I don't understand. I thought we defined the behaviour of signed integer overflow in the kernel with whatever-the-gcc-flag-is?