Received: by 10.223.176.5 with SMTP id f5csp991033wra; Fri, 2 Feb 2018 09:20:56 -0800 (PST) X-Google-Smtp-Source: AH8x225jLZazc2BFHaE3UzMJzwUVkyBaR92vWGCDRWw9uSYDe2JHbZdZa0KqzOXeKeJovRHI0+M8 X-Received: by 10.99.163.2 with SMTP id s2mr7128495pge.264.1517592056269; Fri, 02 Feb 2018 09:20:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517592056; cv=none; d=google.com; s=arc-20160816; b=TJmpYmqw/f+zYIU3Pto9Qgz2OAzkkUx7pM7zxT07XfF1cLk5VpqxDt1emw1B/++aJw 842/kAXFlMqPYr9t5LlJa+Lb63v9quXxOT6/cR/Yc+1yXW+MFzmj5xhYbp7wNhci67rb v8j0Otd+6SGRH2K9YGabPUt/CMQEyrFUbVnK1xHPCYbPff5QgNponL7Es9z90MgQHYRU lTllgg90J5qbpaw5alBX5P5ztI9DwI37KJAlF4ebB961i43nJurONU2biySiSUhFQcar BcL8FpX5QmG9p3sEqBuPuvgJqLjwN5rldBMWef8ung2S5V/M5BQ7z5Omg5eI1lobo2Ku NkXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hiAea9G7+pAFUE+xzgLen/7lF6F7zsZSn7wDsv2YZEs=; b=r8rD00GxL3rKwGetlvfisr+TUzgmkwToPE/+tP2yEyHgTJbLDrZEueV8sAxLA299XR 2YtBu+CtoFkKdRo6VeGMRT+kOV2B4tzxGlIE+ySYBSULfcGy4G2DHgLGc2nNzOjLak2j EjKDuk/XjM48vFGKUS3RQdqat3UTXV4jbQ2GuCxaKY2unZPWB1LLxr/DYXxosS6eavlP munHoJ+Qv7UIdt224jW4ey/sTOhQbSlbqTvbagEl0TT/3ycBfd0BkDzH6IIOjkdHSCQ7 oKLf105y2u6QNkEbNQe7O46wW3W36hIwUnN4j6LbulX6dnjsA6g9wKjXsxuti0axa3aT ZrpA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si18595pgb.832.2018.02.02.09.20.41; Fri, 02 Feb 2018 09:20:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752682AbeBBRTq (ORCPT + 99 others); Fri, 2 Feb 2018 12:19:46 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38932 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753449AbeBBRMQ (ORCPT ); Fri, 2 Feb 2018 12:12:16 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D7899F17; Fri, 2 Feb 2018 17:12:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Brian Foster , Sasha Levin Subject: [PATCH 4.14 114/156] xfs: ubsan fixes Date: Fri, 2 Feb 2018 17:58:15 +0100 Message-Id: <20180202140845.335861525@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_aops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- 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 <= mp->m_super->s_maxbytes); - if (offset + count > mp->m_super->s_maxbytes) + if ((xfs_ufsize_t)offset + count > mp->m_super->s_maxbytes) count = mp->m_super->s_maxbytes - offset; end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); offset_fsb = XFS_B_TO_FSBT(mp, offset); @@ -1265,7 +1265,7 @@ xfs_map_trim_size( if (mapping_size > size) mapping_size = size; if (offset < i_size_read(inode) && - offset + mapping_size >= i_size_read(inode)) { + (xfs_ufsize_t)offset + mapping_size >= i_size_read(inode)) { /* limit mapping to block that spans EOF */ mapping_size = roundup_64(i_size_read(inode) - offset, i_blocksize(inode)); @@ -1312,7 +1312,7 @@ xfs_get_blocks( lockmode = xfs_ilock_data_map_shared(ip); ASSERT(offset <= 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 = mp->m_super->s_maxbytes - offset; end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + size); offset_fsb = XFS_B_TO_FSBT(mp, offset);