Received: by 10.223.176.5 with SMTP id f5csp980933wra; Fri, 2 Feb 2018 09:12:05 -0800 (PST) X-Google-Smtp-Source: AH8x2254UzRHtOrsGJ0Re9thGTWWIAPRs6dYeysdo6YQMnbu5CzP0BhdQEdyseu+ZgC8DU/wTaD0 X-Received: by 2002:a17:902:2702:: with SMTP id c2-v6mr33771421plb.342.1517591525245; Fri, 02 Feb 2018 09:12:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591525; cv=none; d=google.com; s=arc-20160816; b=YHWUDxjvmCv9n+MtKD8J+bAdGR9+0aLLJffqFX99L3J3sk3xiSu1do7fTodQeySWU7 Dqqju6vABwoIwD/M6AErY/hqCSh7/k5zZotEbjnIXfMVFdT+u1kTIyvac/44kB/OgxPl Fsje5CYmG1qc1ryu5JDA1TVaBYb8GUhQt5ZB8l95bmwiZsb54xVDDEIIfwbA8A7YApNP +QLN1h8lV862T2J5xunuHlLF7n6vrqAMkRbHjmnKEgNUHQQhrAQTlirP6UH2hYbvYgZs OQiqibwt3rIZysu/R/M/PX2cWbR7Kj18rY01ir7akxMw2GN3A0C/oEE80YtiUKWT6a2z Yu9Q== 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=2YtZjnB0oXTsiMDqOQ12Nh8TQJF8ruJ5uYf5ebns/+Y=; b=F4hyDlE2kr6XfC3LeI3tSZjyriJTL/65lArkbe/Q9o4aG+Ump/b3p6eNI/leT75jo1 iXejGn4SgMemc3eND0/NF3naK38NB6NrVmndTY/BaRxBDVNlV4dcUw+YwaWumDLz3kYQ mDGgPWS2/n4trq2MpRAg/kNK0VR4hu1cnuMwZezd4S4ouZV0QSBVildgSTeJt9R81wZN PDnqb1EoldwXkWYG2Vt6j6Wv+FmDfHflbjeHcYLEPNaH+8KYOxdwVL86/JDAj2TUqBMV Tt6Y+0BKcU7rwQCEZqno6P6pEWyigc6dkOJlRmMBD82J1T9F649k6T+317hSH/+2GpvW dl8g== 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 o18si2108677pfa.407.2018.02.02.09.11.50; Fri, 02 Feb 2018 09:12:05 -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 S1752849AbeBBRKV (ORCPT + 99 others); Fri, 2 Feb 2018 12:10:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36476 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752990AbeBBRFZ (ORCPT ); Fri, 2 Feb 2018 12:05:25 -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 C80D7E16; Fri, 2 Feb 2018 17:05:24 +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.9 61/86] xfs: ubsan fixes Date: Fri, 2 Feb 2018 17:58:21 +0100 Message-Id: <20180202140828.126283200@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140822.679101338@linuxfoundation.org> References: <20180202140822.679101338@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.9-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 @@ -391,7 +391,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); @@ -1295,7 +1295,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)); @@ -1347,7 +1347,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);