Received: by 10.223.176.5 with SMTP id f5csp974718wra; Fri, 2 Feb 2018 09:06:41 -0800 (PST) X-Google-Smtp-Source: AH8x226LP4HmmsjaGQq44lXvs9Q4qVovSCahvGSh+V7Lx/5o4V67IvF70Sps9khfxUCfnJTwpdaV X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr5451535pli.410.1517591201400; Fri, 02 Feb 2018 09:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591201; cv=none; d=google.com; s=arc-20160816; b=y/yC6I/y8vmIStoPtXWlp4500X8005vvopHCrRx8UEuxzwtzNIvJJq25jKMZVoENEY 3J9SdCeY4ZFBbUHsxkbuFx+abDYYWxRDX7Vs47uZpJdVASjxzsHHBdWN5E53DTHkX2eN 8gyBzBWUTxB/AAiSJpuv1f2zx71eivWYWlkRfm+Ew5wL9xxqOcer5XCq4Eyds+FIN0Md p51dZzwsIBE+Zv8skLlhyQRGfHZpZXN5lTdZKa+x7Nm1qACopwDYyKADQIqLDb7qE1mD xn5vs7Q9cqHSK4ThjCZIyp1gTuNdAPA8CWd0vmLyxDPynqKHViXIAyCUQV9daF9o0mJ3 n/nA== 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=UqfzBEFizmWcDpEy+b6xA1twchy+qMM+SVajx7cACJs=; b=vdTg4s1TO+sFyEbSWa6Kn49Rg4IjXSzs7cFhwhw/qZa9wNH1o4QTFpN5T14hgRbbRv n4Muxul/3N2HiMi41fHjgbcV90JV0AZyDUMLzjDYnPYRNojSPMN1UitKpPdUF35le6OG l6aO51KMTOi42/J/8i3CM8ao75D3xMYm7SkPdqrmgRI68aCHDd169ohn4odeCjzS8KYs wvBTXxJqwt03GXqL/NiTef6kJj9YSQp1YQwN7Kbn8pvf6FL3QLmNAwC0Airf9HGPsvF5 hVJ5f4bgNQL5tgkATtHj4jQYn/mHZFiOZd6kKrw7EUAeMt2TYmnYojJKO0gY2MHFJkY3 +/uw== 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 c19-v6si2141863plo.278.2018.02.02.09.06.26; Fri, 02 Feb 2018 09:06:41 -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 S1752854AbeBBREN (ORCPT + 99 others); Fri, 2 Feb 2018 12:04:13 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752593AbeBBRBc (ORCPT ); Fri, 2 Feb 2018 12:01:32 -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 1DB0CE61; Fri, 2 Feb 2018 17:01:30 +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.4 49/67] xfs: ubsan fixes Date: Fri, 2 Feb 2018 17:58:18 +0100 Message-Id: <20180202140820.758478009@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@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.4-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 @@ -310,7 +310,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); @@ -1360,7 +1360,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)); @@ -1416,7 +1416,7 @@ __xfs_get_blocks( } 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);