Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2684063imu; Thu, 29 Nov 2018 08:40:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/XHnIDi5y1NLIMCv2yiw6m4UZ9SqEoZJfL5uYqErWOsznSdE51H41tV9z0XIelwPj2JE6NM X-Received: by 2002:a17:902:5a4d:: with SMTP id f13mr2227020plm.49.1543509649035; Thu, 29 Nov 2018 08:40:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543509649; cv=none; d=google.com; s=arc-20160816; b=yN90Uywqaa2zYwElknuf2kuipYLkjbnrMcuTEiHbcUk7bECZ3rlSsXTDG/eReKQ4+z EpI07VxuHWCegr2qyN/IFP6jGvdZ/U34HXvNnwMvKv8xQU0S2ehNeP3N6cqcCv6N5gnu scnwmIachkKXk4WXicRx5ekMba+jgZwKf6JKdNqUrorv30DHRJ+bOcqjXYfe3CfbRZkW QAzbdA4M56rhZLMMZYNI2ULgcg5hWgxw/8hunXzt6aP7zoj7387qVgnG5wpKnPr7NcQc rrn1pItnz5hhLGb3BMaA8+UoHncArpp2XuInfcIvKCtIeDG49rTjlldM2H2TudiTFs4x fRpg== 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=s4KAWB8thmpYH1WwjCgumPIS1PyiX7+UJj97tYgIK5o=; b=LfnsfmynLKKhRxPKdpWV7xs7ESy9ULdk2p7Z1pj9pUXKwru8rlwXxmoX3WbwfygVQ8 I8WlkkJjWo5sNbLEPdEBJ9MINx0eVOseOgOYopWn6/YC5t9o2NzJ+xSCJyvsv8477y4K ictBvQJgJQVFn+ZkvobHYnemqu0cUvhka58DtlEjXnZ4JMgBXxmVGifyI3mIPHekbnXX 8AK8H0IQGfV3ZFIAcdg3aLFJCRLJ6AFxqPWGwyu9LndrnxIc1d9LWNbLg6Pzzhf238Kb wvjJSv8erFW/sSROPkvv+UKiwk+kPhUlAc5MDZvywFPncNqD8D6a4gmoe+1NNzwT4zfm qvcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZHuUacui; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si2367506pgm.339.2018.11.29.08.40.19; Thu, 29 Nov 2018 08:40:48 -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=@chromium.org header.s=google header.b=ZHuUacui; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729421AbeK3DoZ (ORCPT + 99 others); Thu, 29 Nov 2018 22:44:25 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39698 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729218AbeK3DoZ (ORCPT ); Thu, 29 Nov 2018 22:44:25 -0500 Received: by mail-pl1-f193.google.com with SMTP id 101so1295515pld.6 for ; Thu, 29 Nov 2018 08:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=s4KAWB8thmpYH1WwjCgumPIS1PyiX7+UJj97tYgIK5o=; b=ZHuUacuiSSYMQEtgRUiXKlj3vykdcFrM2GcB2KYfq7rKkw8B3kfMoDOPlUyuekZ1BL 10x4k4jwYAZhq9LHCN1sh0lhH7vuZcXVjqXot5mt9c8q3y7TsMJtxDTdBlexFrFPUfGy P+/orrYrGhSDcz/uIykP7tGUzT8p+hyRF5qS0= 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:mime-version :content-transfer-encoding; bh=s4KAWB8thmpYH1WwjCgumPIS1PyiX7+UJj97tYgIK5o=; b=mkr7U1Zuwtm8TpQEUC258D2cBvaTASOq2NiSzMrMAF+BoxFBUIXJN1UmD2JpDyfnGV yWNvtM/VS/0zepNP4pxcO3LhFhHgI5OkjPJZGfs/ojQPnWd8gkAVYA/Uja1vmMAT3qAa jl4ad3JDxQJDDcRUChPqOMW/Mp2KXZy//3nVF9MKzROpZUD8YzkzalYhstGez2KVTzyP gAV46vJ24xrS4TgQOhsjJWhNhzC63VTAqCV/PXwwW/rE0inLq961W6aFRH2IdhDXdZiV djimCd5bNn6IoCOOFa3mfqxVzwAIzkdiN6hwNU6YmfgMaFYdOV/LUSPIy2Lf9OeiSO1y Jo0Q== X-Gm-Message-State: AA+aEWa2ymLFEqLm+/BdoVYmZ0mKJSQWpaEGxLqDB06gUn7RW+eTDMzF TZKLNRFT7HeXdYFmKSrbdgwItA== X-Received: by 2002:a17:902:5a4d:: with SMTP id f13mr2219688plm.49.1543509508040; Thu, 29 Nov 2018 08:38:28 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:1:fed3:9637:a13a:6c15]) by smtp.gmail.com with ESMTPSA id s37sm3033836pgm.19.2018.11.29.08.38.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 08:38:27 -0800 (PST) From: Stephen Boyd To: Andy Gross Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stephen Rothwell , kbuild test robot , Jordan Crouse , Bjorn Andersson , Evan Green , Rob Clark Subject: [PATCH] drm: msm: Check cmd_db_read_aux_data() for failure Date: Thu, 29 Nov 2018 08:38:26 -0800 Message-Id: <20181129163826.178670-1-swboyd@chromium.org> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog 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 We need to check the call to cmd_db_read_aux_data() for the error case, so that we don't continue and use potentially uninitialized values for 'pri_count' and 'sec_count'. Otherwise, we get the following compiler warnings: drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12': drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized] pri_count >>= 1; ^~~ drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function [-Wmaybe-uninitialized] sec_count >>= 1; ^~~ Reported-by: Stephen Rothwell Reported-by: kbuild test robot Cc: Jordan Crouse Cc: Bjorn Andersson Cc: Evan Green Cc: Jordan Crouse Cc: Rob Clark Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()") Signed-off-by: Stephen Boyd --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 8cd294e2846d..b450f7ea0422 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -936,6 +936,8 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes, size_t pri_count, sec_count; pri = cmd_db_read_aux_data(id, &pri_count); + if (IS_ERR(pri)) + return PTR_ERR(pri); /* * The data comes back as an array of unsigned shorts so adjust the * count accordingly @@ -945,6 +947,9 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes, return -EINVAL; sec = cmd_db_read_aux_data("mx.lvl", &sec_count); + if (IS_ERR(sec)) + return PTR_ERR(sec); + sec_count >>= 1; if (!sec_count) return -EINVAL; -- Sent by a computer through tubes