Received: by 10.223.176.46 with SMTP id f43csp274848wra; Tue, 23 Jan 2018 20:50:13 -0800 (PST) X-Google-Smtp-Source: AH8x225MxgYoIrxt0AZzhxaFU1TeYIqFdm+vd7o/ZlVBh6/WBq7VX1mquJqZPfpfwYHqvSXBm4ty X-Received: by 2002:a17:902:6849:: with SMTP id f9-v6mr7240465pln.113.1516769413275; Tue, 23 Jan 2018 20:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769413; cv=none; d=google.com; s=arc-20160816; b=OwlftUHeq6QXVqDX+WtEgKIAOFmLUX/fL62hhJMUJeB7x4zhroXKhXQQmua4aqm4ob 0PHUvthutKG5hdSNyYP5U/NjQl6YzOjKwzQiD4h8hDHkNvdXxQV/ZQulQfVyXO/8e+70 pF2CkeXnNOS504mRyjUUdpeXyAvGNgt0KkY3uEa8R9DVED2rXyirIlRAETnwiGwm3PFr L2LePtpNGIQu8d0IiTyh5jtxOCBHeHkewC3ALSnYbgOEREhSlwnOPqobOoNQTAYe5/kK i4wGwEaUkOS2iEOPTvKLJBwrnv306VfbV0mZc07c/lLZ2/tcsnht2pcqfLcTr7RYuWGK ofTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SvCK057/7g+2C2oE6MuxLe4HyK5NhKztNENV7szC8Pg=; b=jwTILonWxIpqV1D+OinXbCJqpfWq5mGlSK0VdW050cgI49HuYIbLiBOecY+qRgD9N5 h0mapYdy+UC96UX5dEd4jtZa6gYDITE4h8n0B6xxocdwb7UdWBdUr/8YrMpanqWbj+u2 rbBjtufVSKHx3Ek6/nbVvEYOgE3dcNfrGfx3cfpbmKk2CzWJj23L0+4Ky1ZrGUbKHEr9 2+4MNiydl78hipjomopwC26jcvdLwINeUX+/puowNVbHPsEunQEUpfIsiIt2dkQQDQ8N 9NuPK19w5tLgc/Ib6Z6V9gNapnsVpYJkXbzgctObPnBqZ1GvitXKZ0TRKIqmCQzsmZsJ nmsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=TcETo0Yb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r16si13598220pgq.26.2018.01.23.20.49.59; Tue, 23 Jan 2018 20:50:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=TcETo0Yb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932719AbeAXEtX (ORCPT + 99 others); Tue, 23 Jan 2018 23:49:23 -0500 Received: from mail-sn1nam01on0109.outbound.protection.outlook.com ([104.47.32.109]:14147 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932506AbeAXEQH (ORCPT ); Tue, 23 Jan 2018 23:16:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SvCK057/7g+2C2oE6MuxLe4HyK5NhKztNENV7szC8Pg=; b=TcETo0YbyzUnjZPYlir9pw7jZFuhq4RkzBvqOwr+Bs0JueZx7Fj+NMMi3Iuwc5XE4ciUNmh3VPjEK6Sks+xJUYKPO/Fd0CBmsS3pcKFSi/Bmh6BHPYJ1c7NIQqQSasxcElmD/RZFfbOTk5rUPm1TrV+W+4Y7SVYovv/PufyU+Eg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0727.namprd21.prod.outlook.com (10.167.110.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.1; Wed, 24 Jan 2018 04:16:05 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:16:05 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Darrick J. Wong" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 088/100] xfs: ubsan fixes Thread-Topic: [PATCH AUTOSEL for 4.14 088/100] xfs: ubsan fixes Thread-Index: AQHTlMnt2yrto1EERUW+8toLQmSUuQ== Date: Wed, 24 Jan 2018 04:15:10 +0000 Message-ID: <20180124041414.32065-88-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0727;7:8qy/GfCEqSIv3jOGdCQJCSttJ7O0ZSRBiBUPsWNLAexvWOQcls5L/t6U+mBcgtNC1DygjS6dKXufSMzXTRbIjpj97QTyaQJbDX4r7YAWOvN21/RcBixBVGJOeokHenhg17i/GoYJ1UjgOXv7shOEIhC/76iAm1SCquqqqu1BfSIP+8lJ6C+TswAZQa9ld8UyfJ+p/KnSoJyQslpo/lOA9mEtuiT56aeQtaMON0V5xnumR24vRQ454u18HVzRgCo9 x-ms-office365-filtering-correlation-id: 794bbef1-c552-4420-0b8f-08d562e12fd6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB0727; x-ms-traffictypediagnostic: DM5PR2101MB0727: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231046)(2400081)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0727;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0727; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(396003)(366004)(39380400002)(39860400002)(376002)(189003)(199004)(86612001)(6506007)(106356001)(76176011)(59450400001)(6346003)(54906003)(575784001)(86362001)(2501003)(110136005)(1076002)(7736002)(5250100002)(3660700001)(316002)(26005)(102836004)(2950100002)(6666003)(99286004)(97736004)(22452003)(107886003)(6436002)(53936002)(478600001)(66066001)(14454004)(2900100001)(6512007)(2906002)(5660300001)(8936002)(4326008)(10290500003)(305945005)(10090500001)(68736007)(25786009)(81166006)(72206003)(36756003)(8676002)(81156014)(3846002)(6116002)(3280700002)(105586002)(6486002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0727;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: rL3FGbyjl3bix6ExEbA0uR9v9Mztbr3tPYE9vSXw2plNsFs4O/x+R6tF8n+6va1BFjvhE531+zxawsg8b4Q0EQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 794bbef1-c552-4420-0b8f-08d562e12fd6 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:15:11.0018 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0727 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Darrick J. Wong" [ Upstream commit 22a6c83777ac7c17d6c63891beeeac24cf5da450 ] Fix some complaints from the UBSAN about signed integer addition overflows. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Sasha Levin --- fs/xfs/xfs_aops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index a3eeaba156c5..b0cccf8a81a8 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -399,7 +399,7 @@ xfs_map_blocks( (ip->i_df.if_flags & XFS_IFEXTENTS)); ASSERT(offset <=3D mp->m_super->s_maxbytes); =20 - if (offset + count > mp->m_super->s_maxbytes) + if ((xfs_ufsize_t)offset + count > mp->m_super->s_maxbytes) count =3D mp->m_super->s_maxbytes - offset; end_fsb =3D XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); offset_fsb =3D XFS_B_TO_FSBT(mp, offset); @@ -1265,7 +1265,7 @@ xfs_map_trim_size( if (mapping_size > size) mapping_size =3D size; if (offset < i_size_read(inode) && - offset + mapping_size >=3D i_size_read(inode)) { + (xfs_ufsize_t)offset + mapping_size >=3D i_size_read(inode)) { /* limit mapping to block that spans EOF */ mapping_size =3D roundup_64(i_size_read(inode) - offset, i_blocksize(inode)); @@ -1312,7 +1312,7 @@ xfs_get_blocks( lockmode =3D xfs_ilock_data_map_shared(ip); =20 ASSERT(offset <=3D mp->m_super->s_maxbytes); - if (offset + size > mp->m_super->s_maxbytes) + if ((xfs_ufsize_t)offset + size > mp->m_super->s_maxbytes) size =3D mp->m_super->s_maxbytes - offset; end_fsb =3D XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + size); offset_fsb =3D XFS_B_TO_FSBT(mp, offset); --=20 2.11.0