Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4823123ybl; Tue, 4 Feb 2020 02:36:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwXrv4L/qd7UukuHbF2y/9x5oai9xxquMPhmeyokS6F6NbOb3Njbd/Ds1vtPcmJZI1+2PMt X-Received: by 2002:aca:5844:: with SMTP id m65mr3013173oib.136.1580812615414; Tue, 04 Feb 2020 02:36:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580812615; cv=none; d=google.com; s=arc-20160816; b=FIsEkzxwonZCqc07A8LghlUmH1L4Pe6Wg+3KJZnUp5yWo291DQBi8TMoHpmtDIKJXy CYvQDtE1nCvumVA1pNWwsN+dP11iD1vNTcBrPsihcQLEiIVbZF1st6rNaRfTd6eWG6PQ mVNhkF19ZgfXBST+i9ee87jWSMhbGOm2o9t7ppI8cj1Y2kPpnRIztqByqrHgRlO2paxX 4akMXyMr+NdLVilttysbtNGmyRh/WIYprInEkSnK+Nmo6B3tmXpJZirWtba9cIbVx0H7 k78bMXu9Zxv1PMTrFWjCH+2WeD95MflAagfpsnv6XW+pxCAwxssNqtqih0cnM+vx25ZK d0SA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HgQeQwoib86MddFqeLqOm0fyxZAN0jXSuJfjQMWlMmE=; b=M9XPi7CpcKAajqKwJsHX0DD/+/Y7fgehgJz44HtbzmkiPL98sLtxIHrm1u/6ccpKKq owxBQb18nq+IcW4TZjiAZE8gkme6NyMb9RlwDt3k5qyPM+Mc3Vsn4pSHGf9SxqHpyPLr 0AomwTMGI8ogSzZ2RMJhaoytxfJ3NjqwOKTEXGCjP+55IGP2V1+qt7Aefr2vXFHtftVH bN/jqb5bv4N49ECSJQjT0ykQeFV/WssQedC7G/6lbF5DvDfAHXOE8cqh6WrfXKr4SOTy wFo9YKcuKJOMQm6Ez8BFdRYg59XzT6Vn/PlgLHvl8DHxLZaz+zC4vs26L1JnNzdf5yfv XMTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=mAn8yNeO; 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 q189si2739518oic.235.2020.02.04.02.36.43; Tue, 04 Feb 2020 02:36:55 -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=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=mAn8yNeO; 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 S1726855AbgBDKeY (ORCPT + 99 others); Tue, 4 Feb 2020 05:34:24 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35512 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbgBDKeY (ORCPT ); Tue, 4 Feb 2020 05:34:24 -0500 Received: by mail-wr1-f65.google.com with SMTP id w12so11389259wrt.2 for ; Tue, 04 Feb 2020 02:34:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HgQeQwoib86MddFqeLqOm0fyxZAN0jXSuJfjQMWlMmE=; b=mAn8yNeO73OxIWDplWTweaT2fEQ+AU2pnxx5itVBpnwq834FQdanmPPCLy6h3lc/zG tSPo1hN2snWZniz0bphZnwK4+1VCKRNBtnPp1AZ7/Id1S2F4TmPnbt6VCcq8Io5s4+ec F8YI9MlNfukki57kktNlMRJWqe0IINHQ944yNsgl8m4oCzjtbOE6IMEA88C9cufkt9Fp 0KV7LUHs7LxHGCoLlLGvgy9agp9cYmERlpiymhh1+50koNezAKd14lmbHuYwGWNbel+e cg3iK0/DWlQqAlmXvOm1/YKqcj2t5ocD+nlfLfK3QRkdcUVVkiGk8F0B4Yo4/7zwsDmj Ds9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HgQeQwoib86MddFqeLqOm0fyxZAN0jXSuJfjQMWlMmE=; b=TTR6OfEMyI/+hoRpoItmPD46eCRCcTrozhZIPzxXVk2dmB4rfZ8hC2bFRbkMxmXYzq Greb1mf5WgiMtTLPqErekmfuAphESwa/hemWfapXNQV3tMzHvJV+wMUQPeqx1IefGMCZ 9eOqRqbESQQlLcH2mcGOA1jMK/otccFtz93ebRcTn3NeGGiqIRdw80Uy5bNNkW3Enb4I 26f5gL5yveKAUdIUYV1VQjUCghuYWYc02aor/hgvCU49CvcrlCayB5UIZnp/6QfILNS2 JsV5toFFQFwb2tprBqIMhBHpf45UsJzyE2FEBB5UwsaJ1t4/mCxQ72UA0E7iU0Vwjpjm /4FQ== X-Gm-Message-State: APjAAAV8D1lLPiDa4KbmJbZfVOKns8kszrKDAGPD+Ed1XDULGPKES402 kLtixKtI8uwGLbw57Y8cSrItsWsEAYbtfly14Oq04EapO/c= X-Received: by 2002:a5d:6b82:: with SMTP id n2mr23383267wrx.153.1580812461793; Tue, 04 Feb 2020 02:34:21 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Michal Simek Date: Tue, 4 Feb 2020 11:34:10 +0100 Message-ID: Subject: Re: [PATCH] microblaze: Prevent the overflow of the start To: LKML , Michal Simek , git Cc: Shubhrajyoti Datta Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =C3=BAt 14. 1. 2020 v 13:34 odes=C3=ADlatel Michal Simek napsal: > > 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 =3D ~(cache_line_length - 1); = \ > - end =3D min(start + cache_size, end); = \ > + if (start < UINT_MAX - cache_size) \ > + end =3D min(start + cache_size, end); = \ > start &=3D align; = \ > } while (0) > > -- > 2.24.0 > Applied. M --=20 Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs