Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1932246ybv; Fri, 14 Feb 2020 08:26:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyWVbbO02LDeZFUU8xH/f9nD5xD5tbIij8rXf+eDhpZPoJwutTzh0oR+55TuOW9njnUBcOB X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr2449087oig.81.1581697614297; Fri, 14 Feb 2020 08:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581697614; cv=none; d=google.com; s=arc-20160816; b=iH7R/L5mKFAerR/ouSmVgPLiO4eHbRgdPr7/3AhEN1BZ9RaVGR60u2USgwjeWzRWRP dfpG7nj9/k46MOkk9YxPfGS5Qj/JDdin3ZS2QPcmWFF7tgSsPg6QWmk2D0xQNrjuBQaU 6itWnzEdY0HttQQX+xAPwbcWvN6gBBDpqTJWF6dHUWlBhSYhP6wE0/QQZU1Wdf240Af7 VqZgwnF7K96sjJ3QOmjl/zaya5NmQoXK1RQ/qJItiJyB3ndlc/1nlND5MLxS+0Z8lJXe da1L6vft5U7cMru66/vkhuyFKbQgK5YN4Dk07A0zR6/TuJTnt6c8f+qNe9RVU7+1UdQ9 RuZg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PC/8wT/P0aR0CrLFEKHXw9pBehzO54MSiC9FK9gUZMY=; b=LV1sGb3XlQ2wDPPrPbj2xyUi3gdQUs00DxSwcqEC+JflhYSa1v+TD67O1aJxGJ/WwK OEdls/1bCHuoktb6fnSg+tHKCeEsdAjm8bS6O77nGILamnU2JzQkuVUSZiJKGBwobgrO WqP++3LKbu2PkQy3+iYtgdO8D8XLG2kZKDpHf2hfPG8ZBoVowI30U23CBQjWpHRNUgRd cDlMcXBT8aNwkRbNqi+ZavqTgJDumo4qcXkubkJxUc4Bsns/iv0V4EY0FIb8wV2xLaKz RPw39uNmzun+z7jAyxVoplrpP+Nlmnn6Oo9sZtqnvFYXW79h5aI3M4Bdbk238An8oEtC S/Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IuI08xUb; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si3097001oic.66.2020.02.14.08.26.42; Fri, 14 Feb 2020 08:26:54 -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=IuI08xUb; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406386AbgBNQ0R (ORCPT + 99 others); Fri, 14 Feb 2020 11:26:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:60982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405503AbgBNQYP (ORCPT ); Fri, 14 Feb 2020 11:24:15 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6B9724798; Fri, 14 Feb 2020 16:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697455; bh=bsY2Ez2fjYKqL4INXHo6t0AnfkI2oIAHfv+cfuoZhC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuI08xUbg008Z0spwAhVO2KfLJJvdcqTmo01UZ8qlPZnTo/psF7DwnmkFSL8T61Uc DUisHjZmbcTVZG8tj3Ez+JMWyoRfSIrRLq0ACd2kNbKJDYqOE64xvHshuxveT6+UaK i2NiJZ66yeSu3JSu6IVuly4h50RrCci3/rkIvUSI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shubhrajyoti Datta , Michal Simek , Sasha Levin Subject: [PATCH AUTOSEL 4.9 138/141] microblaze: Prevent the overflow of the start Date: Fri, 14 Feb 2020 11:21:18 -0500 Message-Id: <20200214162122.19794-138-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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