Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8840786ybl; Fri, 17 Jan 2020 02:00:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyC4Ru4I5B/Nglx1/c/9hCJL3NSiDDfuqipksu2WW7uJOO0cRElKX8O5yGyJ9r0MpAWO6dn X-Received: by 2002:aca:59c2:: with SMTP id n185mr2839480oib.170.1579255235482; Fri, 17 Jan 2020 02:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579255235; cv=none; d=google.com; s=arc-20160816; b=avUDLmaikVtrV+9FQI2f/C4nDcDcx8SFjKXWuNrWYtXg0qGz2UOg1g+Zp/BeUBcE8G nHpp7ZQlLoWasyueGDE9gElRAt/8yr2DFXkfGTuBJ6totfYNNf6Ba7FSJtR942ONWmfM 4G+48CjDNWZ/QKY5/OiAXwmpktyAkP7t56j7vz3TOHCRQnDNXNqLRj+lUNoaUd63rX6P EjvlkSSaRKeruRL7YfGPmD/46vZZPsxNYGN4MNs89T2qU74DPOIRxJXSLH2x7mkVpkqm VXFKeM/VR2wvPjmab1S22tAhveHACkg6UjtKijKUxUvKQ6CLCPWoea2dBRpfx/lKtfj6 zlIA== 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=qs32CPE+6w8H62hd9kXr/ee/9U4Omu1sZciOmm+hYl8=; b=dCK3FdQgLNIJAnrCEKaSMf0q0Sf41jitbxJCmggaYD0P9nvCYjnhOsIuuh44wEPAsu GL2qwBu9YEUvUt8nnq/baScpEDsX5hvyWTcGxhwSUTMsD5lJUoZph01R1aiG2J5yAbtR KVHyvozZQVNSI5ZhQNjoix/FAxVtsSowEJXjfsRhqq9mV+c1JQUlymGcLgCIG5wMVg4D GFK9TP4JNV9pVNgqsQHJ220SR/1r4oI1vUytJySf0d7uMTIf7N/9mP8CD2yZefk/YUu+ Y/Wpt73jCic0OKe8uBWYmCHXn/7SMgB8ggPPu1R1JCjS7gO8BVpJ1bkPhI0/+HA9L7wN X1mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F2avq/Wj"; 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 f194si13962230oig.243.2020.01.17.02.00.23; Fri, 17 Jan 2020 02:00:35 -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=@linaro.org header.s=google header.b="F2avq/Wj"; 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 S1729219AbgAQJ7E (ORCPT + 99 others); Fri, 17 Jan 2020 04:59:04 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:50426 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729008AbgAQJ6d (ORCPT ); Fri, 17 Jan 2020 04:58:33 -0500 Received: by mail-wm1-f67.google.com with SMTP id a5so6810413wmb.0 for ; Fri, 17 Jan 2020 01:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qs32CPE+6w8H62hd9kXr/ee/9U4Omu1sZciOmm+hYl8=; b=F2avq/WjQTkOblM6OBaohDkNkFC/G/rzHjdCB9gkWGztwFXHHLMQAEUFo437ob2btR kbj0Oj3lHdUxPFsEo+CaW1ACvtXvJl2EkqR0VpSmKR0sRe/ImmNVEUpVre4OnXYM99Dq magfKT++abV11SaIJD+AYaG245Qw5xjCzho73AwemJ9Fahz3jpPy1PcHaCWITjNYxMn5 vWs0O9wGbzSCm5biNcq5AlR9vyIynXA5ZO3E9m6H7IsTKX2WSuZtXITmJc4HII84tm+5 GsHAuhK07k1QXb6MwT9SEEr3kBzbO7JEZYuzojx2szjPkmbzNcGWHuprwGaqWFLbrJW4 CbIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qs32CPE+6w8H62hd9kXr/ee/9U4Omu1sZciOmm+hYl8=; b=OyVx3kvslmLTbpZmTRwH2FOM5uLlpPsQMkeldZbE276g79tPX3V37ZBH7a4sTDGzsU cj8kHDGd8I2LBqBxm6tSMnSoWDcqdh/CduojowmrVwn9EqiB3DNPvr07ZpjjQ8e6IpQ+ Ltu4q01D76Xj8LACXqYlxygzt6rkGB9KI3dsAEZCcwj5g8Vp6yBwAOWw4lTRtQF/V34z WtdqaXjUY+INSsfHA5cnvsPKpEgv0Ax5E8V20DQ86hwvj6URtX5FR1jkl4MlImo38une 8+RnBTnSHgyQlhSn99Mm5wOXFpD1XCH1mT3J/VM/yDnTyqKyjB8AuEpjjVM7Zygw88aZ lagQ== X-Gm-Message-State: APjAAAXnR+BSL2piZaa9tSAuzyr+ylJb/88but0eGUd2xnri6h5QYh5T yyrdH0TFxv6Y8WuPQGcfv7oPKw== X-Received: by 2002:a05:600c:2c06:: with SMTP id q6mr3880069wmg.154.1579255111881; Fri, 17 Jan 2020 01:58:31 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id r62sm9967007wma.32.2020.01.17.01.58.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jan 2020 01:58:31 -0800 (PST) From: Georgi Djakov To: gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Georgi Djakov , Evan Green , Bjorn Andersson Subject: [PATCH 10/12] interconnect: Check for valid path in icc_set_bw() Date: Fri, 17 Jan 2020 11:58:14 +0200 Message-Id: <20200117095816.23575-11-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200117095816.23575-1-georgi.djakov@linaro.org> References: <20200117095816.23575-1-georgi.djakov@linaro.org> 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 Use IS_ERR() to ensure that the path passed to icc_set_bw() is valid. Reviewed-by: Evan Green Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 10dde5df9251..f277e467156f 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -495,9 +495,12 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) size_t i; int ret; - if (!path || !path->num_nodes) + if (!path) return 0; + if (WARN_ON(IS_ERR(path) || !path->num_nodes)) + return -EINVAL; + mutex_lock(&icc_lock); old_avg = path->reqs[0].avg_bw;