From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FF09C07E96 for ; Fri, 2 Jul 2021 19:58:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36A0161402 for ; Fri, 2 Jul 2021 19:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbhGBUAt (ORCPT ); Fri, 2 Jul 2021 16:00:49 -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?