Received: by 10.192.165.148 with SMTP id m20csp3919898imm; Mon, 30 Apr 2018 08:35:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoK2t8edO6oREb9NMfCiqTGw5RrCx6BCyQHmOaK+Dd9eCFZN4ywYYX3S4acUI1mk3LRkmx6 X-Received: by 2002:a17:902:284b:: with SMTP id e69-v6mr12547344plb.240.1525102505881; Mon, 30 Apr 2018 08:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525102505; cv=none; d=google.com; s=arc-20160816; b=M3T4lHjnJHFrMZwa96RR1jMQSPke8R3szHzArloblYicnmwotQ2eq8aRNd39LTw755 2UhcXDJJYb6VrLtElRUj8v0zihoV8HN/jdY/80TdNGR1NuWVsQwmJgQKEFLbvUn97qVi vq12n5A2JEb02JgAP0tEcSmKJ6kGqao5+QFUbFaElOq+4ctvrVLyPkkA+BHKx93ATNoA cXJtevG44yYE31B/JYMmg4U16/X9hFIiSpIHOdZgDQVMpB6TlCTO98pd1AUTWjWBytXK oP+BSPkop8aKQVJELRr27PrmkIPjDmOIQzivtwbL78eOTCCUaGxoKB+YSvh1lGC4ubUe jXMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=lt8zZOV7lmrvt3xba+xzHsCUaKn7BxZ/t8opAO4smug=; b=BeNogoKXP5XmbdZJQnMx7Hug6105PifJFojk6Bd7r2rXqutPJ39gwy8u0op9Xqrpj3 cC2s+aRQ9q+DT+ETBWR480eTS++qJqkxN/FcHpaJZkF3FrDey0YDXB/zU8rvXVT3PMzk +e4vivsb8CGBR030soc5VxdbcRaMxa6r+4fZjT7szaGeOoz54icOKB+JqgpfrbX3Fnl5 BWJoF83czlOz7xQRy6P4ItDGYUVU5aZpnAO1pzfHOIeiGR9AfX1itMY8VO5eOj85XRbf Wex/Lbc5maOt/s3vq8+PCp3wsyjfbN8vsqf1CLn+Gvt2XNoCpADfrQVqyWxh5QvRCP7r bs8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSdAoiMR; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14-v6si6327285pgq.266.2018.04.30.08.34.51; Mon, 30 Apr 2018 08:35:05 -0700 (PDT) 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=@linaro.org header.s=google header.b=gSdAoiMR; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754628AbeD3Peh (ORCPT + 99 others); Mon, 30 Apr 2018 11:34:37 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42699 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753480AbeD3Pef (ORCPT ); Mon, 30 Apr 2018 11:34:35 -0400 Received: by mail-wr0-f196.google.com with SMTP id v5-v6so8450006wrf.9 for ; Mon, 30 Apr 2018 08:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=lt8zZOV7lmrvt3xba+xzHsCUaKn7BxZ/t8opAO4smug=; b=gSdAoiMRci8CN/DvUVCjNaK3AsOG5YmNNy3y6szoxtQthO2VVvfPoHo7Fq70SRK7w6 Sxdn8VUiyTrxMpgNvXaXuZMdg8naUyg3n+vzLXC3fiN2A36hBCateyH6GQHAQ0aQJUbV vbAxf1eX4PdVHxZuY+DyWZTPHdS8JmNKtB2EM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=lt8zZOV7lmrvt3xba+xzHsCUaKn7BxZ/t8opAO4smug=; b=pc+kY/1tCCr9KLM+V3NU4gC/Ylwk+XmzRY/650+h98PRHHpLt4XcVpjtDMfzTLN9+j yBqYSwmiYPUCFOBkbIvjeOIwXbHc+W7zpE9FiBapmwIBEi/1/joZoe0kMLwSQs+qA9bR hCwAcLh7OSWLahhzReK4uDDo2P2Dv0y8pnwGxK/DiEhyE/PIk3Z0htBtCL/gVuUGA3Z7 FZYfXjPvYq8+Lhu9l0PG5A4wtmxIwyZciYR4Ad7SQOKyoqVLC8zQe9z3elGjmziHrM8Q SpsY0CT6nhrC9Tr/r6uW91hfkwjF06ZqiNriw10QJR57pG9axFQQ5xz6zBlutX2LhqxB JhYA== X-Gm-Message-State: ALQs6tA6XsbKm+OGmJY7A31jzJbCKXI20hhAuC1mLuBYSdkat2iciFzh y3okxSZefu+cOtCjRYbRzpfM1g== X-Received: by 2002:adf:8b08:: with SMTP id n8-v6mr8518515wra.189.1525102474103; Mon, 30 Apr 2018 08:34:34 -0700 (PDT) Received: from mai ([2a01:e35:879a:6cd0:3e97:eff:fe5b:1402]) by smtp.gmail.com with ESMTPSA id u20-v6sm11558159wru.33.2018.04.30.08.34.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 08:34:33 -0700 (PDT) Date: Mon, 30 Apr 2018 17:34:31 +0200 From: Daniel Lezcano To: Bartlomiej Zolnierkiewicz Cc: Eduardo Valentin , Zhang Rui , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/18] thermal: exynos: fix trips limit checking in get_th_reg() Message-ID: <20180430153431.GB27619@mai> References: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> <1524743493-28113-7-git-send-email-b.zolnierkie@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1524743493-28113-7-git-send-email-b.zolnierkie@samsung.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 26, 2018 at 01:51:21PM +0200, Bartlomiej Zolnierkiewicz wrote: > of_thermal_get_ntrips() may return value bigger than supported > by a given SoC (i.e. on Exynos5422/5800) Can you elaborate a bit ? > so fix the code to not > iterate the loop for i values >= data->ntrip. > > There should be no functional changes caused by this patch. > > Signed-off-by: Bartlomiej Zolnierkiewicz > --- > drivers/thermal/samsung/exynos_tmu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c > index 5a64879..58cd68e 100644 > --- a/drivers/thermal/samsung/exynos_tmu.c > +++ b/drivers/thermal/samsung/exynos_tmu.c > @@ -311,9 +311,9 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling) > const struct thermal_trip * const trips = > of_thermal_get_trip_points(tz); > unsigned long temp; > - int i; > + int i, ntrips = min_t(int, of_thermal_get_ntrips(tz), data->ntrip); > > - for (i = 0; i < of_thermal_get_ntrips(tz); i++) { > + for (i = 0; i < ntrips; i++) { > if (trips[i].type == THERMAL_TRIP_CRITICAL) > continue; > > -- > 1.9.1 > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog