Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1620747ybv; Fri, 21 Feb 2020 00:26:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxR8EOltooTtZqtse4HAFFpcmXyDhgGHHbVY4ZMJB0dgI/s34YwAZEiFymrvewmt/ekmnRE X-Received: by 2002:a9d:6452:: with SMTP id m18mr26317927otl.366.1582273579463; Fri, 21 Feb 2020 00:26:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273579; cv=none; d=google.com; s=arc-20160816; b=vcN0/UySi0hb4LjgRqppxOQ6gHnvmmdD79aRj9qhdDgdojqHn+LzmXm2rohB/MZwPB MSDWfuEZtH8TxSN/NBXHtj/qqHfmzFe7efUx6rJ35+lkbPi7JluvBlZF3Q+MM388/cfL mPX0H06vQ+QSKzlkb8fMf3f7Fjy4MfD/x2HGe3AV47dJylMMbvWNXp0IQ6vh3W74xLg+ yF5JgbjcCNPGytBzwvBi7FXx/A6QuGzL3mHFVE77sbxHS+H3Bf8DZpy6uDewZqacD8XP FuYh7elj7so6GgkmxYB5YYInHJDUFuSv0y34rbVqiydwoyts2hoi6JhIewKAE8Wk7tVi xNOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PC/8wT/P0aR0CrLFEKHXw9pBehzO54MSiC9FK9gUZMY=; b=EL4Ky/6K8BbYu5o53w4+uQDVs8azdamwGcjqCP+pl9ZWNze87eM7uVvU15lI+CE9bA q/DGo0sDo2/nu1KYQBeL8DDFTp5xMA//fFi0dmUgJ4DDE9LGSAzdvZd4WxYDk3k4i5UU QyMaWm6iNC/juQ57O5TIIb2bm8aYS08ybR+v4O6ktgiTf8elG3pAprm3+VYBOSaZLGKI V0v4+A1BNlxnMRer2RereUuacdT9u8O34e80SJUHgcoFxBEqu1fZfNeesoVTdo5ninTL v9d70d8upae2MNY3DOgqtZLq116OX9OSyOax8N3L7KTAbuea8socb4c/l3zvgZmT1K30 /IcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tsAdHtfE; 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 f62si470376oib.131.2020.02.21.00.26.07; Fri, 21 Feb 2020 00:26:19 -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=@kernel.org header.s=default header.b=tsAdHtfE; 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 S1732779AbgBUIY2 (ORCPT + 99 others); Fri, 21 Feb 2020 03:24:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:36912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729774AbgBUIY0 (ORCPT ); Fri, 21 Feb 2020 03:24:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3A58206ED; Fri, 21 Feb 2020 08:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273466; bh=bsY2Ez2fjYKqL4INXHo6t0AnfkI2oIAHfv+cfuoZhC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsAdHtfE2jGGFgkhE5r7lnafBmoOuDF+yF3PjUXK0KB5yUYlTBIwZBSLozQMp1Zcf BFp6QDWKwDkMkN2ln/miU7JgtqpR0c1qoaD4KGVSpvTyQl1f1YwXIBdCCdZfaWXhLq 1Qrb30768XvveXkUvbvYfrEyRxAra+haB/Pebin4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Michal Simek , Sasha Levin Subject: [PATCH 4.19 182/191] microblaze: Prevent the overflow of the start Date: Fri, 21 Feb 2020 08:42:35 +0100 Message-Id: <20200221072312.635260580@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shubhrajyoti Datta [ Upstream commit 061d2c1d593076424c910cb1b64ecdb5c9a6923f ] In case the start + cache size is more than the max int the start overflows. Prevent the same. Signed-off-by: Shubhrajyoti Datta Signed-off-by: Michal Simek Signed-off-by: Sasha Levin --- arch/microblaze/kernel/cpu/cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c index 0bde47e4fa694..dcba53803fa5f 100644 --- a/arch/microblaze/kernel/cpu/cache.c +++ b/arch/microblaze/kernel/cpu/cache.c @@ -92,7 +92,8 @@ static inline void __disable_dcache_nomsr(void) #define CACHE_LOOP_LIMITS(start, end, cache_line_length, cache_size) \ do { \ int align = ~(cache_line_length - 1); \ - end = min(start + cache_size, end); \ + if (start < UINT_MAX - cache_size) \ + end = min(start + cache_size, end); \ start &= align; \ } while (0) -- 2.20.1