Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5160550ybl; Tue, 14 Jan 2020 04:35:53 -0800 (PST) X-Google-Smtp-Source: APXvYqx+ht/xxDUX0wZiC97V/g2ue7ha+Yn+XRofz+PMOGAwch4tjL4u1885jhbNjB7keUGzWghj X-Received: by 2002:aca:d5d3:: with SMTP id m202mr15830605oig.161.1579005353165; Tue, 14 Jan 2020 04:35:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579005353; cv=none; d=google.com; s=arc-20160816; b=pjl4pqRTciK+//fH39VFt8nKgZh7esUh12LTXE1oDXTJ93lKz0vHm6zt4LGPKl857t gMoeSt4jN5Dh45YsfvBCRSu+AdFjYzLKlKOkT1VLd53H8L5jvoWLbP9BzguXsKBfKu4D y3K5biDyL/50nhUPEpjCUl+cDbQ+VXx8i0LfQa6T3nN6uRRFMpmf1z8y8iBJClVQHJ/v idUsU0w/7coV7r+Z3lXkoIQVoEqDg/jBu7W9yVWMMs4aX8WWRdP2pD+jKDhz9tJ+SU5w Fsqgo+08wfaKungYRZeDViiKMOI1Ybi5uoBlGMQqe15tOJ7GWFYzXe2mhMnyIBjnRoUj voNQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=EqOL31gUqSpkjJR99Wdt9hlwWgIJHXjyD65jCY2UG6I=; b=FzLmP6KnaRpwz1aAcalr4PADTJmow5y3YSK4uGVH9L4Gd7ofgweitcuJ3sb4GxCq3t QLHr7Q2vNvuHZJnn9OnQSv5YbFL0EUGrXRD/RQbGJoaWEfhW28YvyK/DjMB+hVnupZIT lioJ4b/164zKL11DeEY0+RyecGXQLBjKfj0pYXqxaFR8LLM85w0+BSmAgSYbzmoAnFe9 SkdoysycxX0LQgbf89/bMbr0VMRpE1nF8B5ah7VT959qWseJhe4WIM8lJY4w8YZNfFbd nJ3cx8JGvlq59kTEdLujpmgg0UCZgA5sud7OYaSkbbTJ0poOQoTkjG+MYQabh/PSzVOn brog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=I8z6hFJX; 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 t15si7522734oij.189.2020.01.14.04.35.42; Tue, 14 Jan 2020 04:35:53 -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=fail header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=I8z6hFJX; 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 S1728783AbgANMeV (ORCPT + 99 others); Tue, 14 Jan 2020 07:34:21 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43094 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727044AbgANMeV (ORCPT ); Tue, 14 Jan 2020 07:34:21 -0500 Received: by mail-wr1-f67.google.com with SMTP id d16so11983932wre.10 for ; Tue, 14 Jan 2020 04:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EqOL31gUqSpkjJR99Wdt9hlwWgIJHXjyD65jCY2UG6I=; b=I8z6hFJX4LIjq3Kd/pcQ91dfqmtM9Q+wHLsRuR+Kxs3Rslsphk4lW1UCDWBkBH+Cwq vcWp3vY5Ias3siQLz7FaqdYLCcXAh7xdzRGBKYPWubjUn8sMiW6j30cvX3/h9SVks243 fQs66w++BdbMhKe2xb9Xnq74SWdjbMmZ2/FucTMMwFxLpBIRp4VaqItGpZ2PSbslVnc1 NU207MB7LPiEM+JchPnp+lhntRbtUAt7KPoI5MQj6Tjr0f2Lea7LJ4OW/tK0t+jGIiFc K1pEkiqs6VPYzXWgRSa2YFmYAJSWG9DtdcnXUlaz4VTRGLw0meFOz0rGwI7pR8frEG9g CiUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=EqOL31gUqSpkjJR99Wdt9hlwWgIJHXjyD65jCY2UG6I=; b=aOBs+QYQLNioTL7X78gP/O6nyfzzMIhZa6Qy1Zoz6ljYAB5CTUNt4yqNiBtnQJ8HXW 4Fiuk4FEBoatCFbdhLe6knXPlYCT7zotZ0ED0PrStOLg8D1clZg0zpRCqQtY/PLyCJ+4 jcQOXfP8oklkw9/1jxahShe/i4P+WspJIiuCRatFKa7bjwkSbxFqm9uBBcDy0+GeWbo2 5s6dXGoy8jJ0+TlidNb/gKlBTkiRBjExLO/ILBbo5B0ofahkzzXqcjU7syaLf39TLlDV WHG7BO6l43Y7XjIc9wCnJJt8Yiy51pQUDA+FaPqU1YMRDpw8ZPRbnY30UnCWxG2AyPtT Q9fg== X-Gm-Message-State: APjAAAX24CVXVKIUetL1r/wGfd1izxnlIn4octg2zJkhDC8TnQPiYWBk grX5oRxy1uSB8IrIwhJDySTuLplUvlICqg== X-Received: by 2002:a5d:6a8e:: with SMTP id s14mr25467331wru.150.1579005259226; Tue, 14 Jan 2020 04:34:19 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id x11sm18604583wmg.46.2020.01.14.04.34.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jan 2020 04:34:18 -0800 (PST) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, michal.simek@xilinx.com, git@xilinx.com Cc: Shubhrajyoti Datta Subject: [PATCH] microblaze: Prevent the overflow of the start Date: Tue, 14 Jan 2020 13:34:17 +0100 Message-Id: X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 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 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 --- 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 0bde47e4fa69..dcba53803fa5 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.24.0