Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp101424ybb; Thu, 19 Mar 2020 17:27:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtvEPME4Zh2dOqyqdYao9VhIxUqZ9nq5ZZUbPWOJ2zD7Ctna5lfoEq9TvouUuviKa0wT3XV X-Received: by 2002:aca:646:: with SMTP id 67mr4309614oig.4.1584664072977; Thu, 19 Mar 2020 17:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584664072; cv=none; d=google.com; s=arc-20160816; b=Z87aixCeAW1gI4m96ld00JTDx7Udf96gXOncGIDSJv/HAjDUQsFKNS2+c8EmZRybF7 pUjteCHH2ArrgAt6bwbhdHnIIx9K+FAu39oQJOWIl+s37D8Tx98Gy012xp6crnWsa4yk ghJt41NFU31jDYgbsP55J6Lxe+3IKFPoDZfBXAm1zPy2RO2AWVIXxAjMW/KxSsxFtLkM g0NpykpQCjczk+kJTnUrLo2mcT5e8v11y3e19JCdBa2ru6dgF8t95cuPs5xvbZ4Ckqhd MD4Yje9T40qynN4H+q4eRhOfbbMLpAZXo4Urw8dq05NnkOouK46YyhSDFobAqdj+76Dt zZhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3CquBIknUh+wWij7pI3+EpiDVMbP4UE5jsk6gx0/y4s=; b=h8kWd4DwSbb/HGx9ZcLQXN8d04NTDJT+QwK+WXsMOV1BX0DLnI9S8k/lv4+z1gCLGX bM1NTF1Gqjfg9gfEp3JyASOHivh6AhFpK2PlQuRm+L5QNHgjkvOlIHYzjczIdnKIOivi gHTzGU/1xXGGZ5Ht9Md4o0ETNLs81Kp6aDuduksUurTIhnNPhi+YgOwk+NjBGMyTGRD0 MD0BilmtTMzt1USQw7+/xPCkxAHQ3N5NdJFCiF7K5gjT8449HmdqNTqIT9kUrB6Vd2rC 0+tLBGmMb3GQ3NRjzSn9GLot/a9jv0MV6TzdPNwKbvoaIhLdszVOVPatTMxTv0/rJDpw a6vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hIL879rr; 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 t193si1853274oih.61.2020.03.19.17.27.39; Thu, 19 Mar 2020 17:27:52 -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=hIL879rr; 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 S1727049AbgCTA0r (ORCPT + 99 others); Thu, 19 Mar 2020 20:26:47 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:38998 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbgCTA0r (ORCPT ); Thu, 19 Mar 2020 20:26:47 -0400 Received: by mail-pj1-f67.google.com with SMTP id ck23so1725504pjb.4 for ; Thu, 19 Mar 2020 17:26:44 -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:in-reply-to; bh=3CquBIknUh+wWij7pI3+EpiDVMbP4UE5jsk6gx0/y4s=; b=hIL879rr/L5dDRaQ5wFuNONmj14fKu2pOrCX0vcpiDCbDvQNW9D0XNhjQ812YIdJcl RFAA2QzyjMzwd4GerjIE1pcQTu7olaNibdMLiloj/OvyJs0dipLnlGDvPoaPJN07LF7F UpfdW8IHurtcqD7j9uunVEbKf7ka1RrgzG9H7++qEoXG0xofRl0tYeR5MQrxj+lu36Tf FZ+3j94YLwPxT4dCVO4muAjKHWNj39N/pscVLolXnbkt+oFHux9FDZk0ms266R6Y9OMV HjGdlLmJ9rmc+0SDvkMngNObYsKNqMJupbmJJiQ14SRp5BiLmdkQnqDHTRwXie3QkLi/ ctIw== 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:in-reply-to; bh=3CquBIknUh+wWij7pI3+EpiDVMbP4UE5jsk6gx0/y4s=; b=dBLRJNfJIcBf4jf1MyOEdEJjHhVWkpyZHOHQa+z/E00GoV9qMBHC7mcCNk1I2rMtDM B3rtRMyAM+d3NZL4pG2hxXQnxbAhaB+7Mzv9G1xi0by5o/HQ+PqwnrKdzdOfrJPnCtko DVhgoQwYOnPydaSjNOuoDtDfjsJyacMbYqC9Y2fYYTXfvMdIsYQIzp+HSqBJv8O1yXOm LkRl6m1+9Y1xy31I3vyQqcTN9a6WWpAFei0L+eJFLmXUJ2WgMW+tkkeDJmvFNb2sVt1G xO5DaRHXesS67JnrNn1jgFRkFuo5f23u0fNS6qZfiafYz/5oYeLx2dO33rueERXuEJCF osQw== X-Gm-Message-State: ANhLgQ0okQ1OUIVm526zRwjY5OMwxdWm9Dpp+4EaWpCe4VgC4X+tbZmi /nEnlLPcsudOe6JdtgvK1OXSXQ== X-Received: by 2002:a17:90a:3328:: with SMTP id m37mr6559226pjb.158.1584664004002; Thu, 19 Mar 2020 17:26:44 -0700 (PDT) Received: from yoga (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id z125sm3629586pfz.187.2020.03.19.17.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 17:26:43 -0700 (PDT) Date: Thu, 19 Mar 2020 17:26:40 -0700 From: Bjorn Andersson To: Mike Tipton Cc: georgi.djakov@linaro.org, agross@kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] interconnect: qcom: Fix uninitialized tcs_cmd::wait Message-ID: <20200320002640.GC458947@yoga> References: <20200319231021.18108-1-mdtipton@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200319231021.18108-1-mdtipton@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 19 Mar 16:10 PDT 2020, Mike Tipton wrote: > Currently, if tcs_cmd_gen is called with commit=false, then > tcs_cmd::wait is left uninitialized. Since the tcs_cmd structures passed > to this function aren't zero-initialized, then we're left with random > wait values. This results in waiting for completion for more commands > than is necessary, depending on what's on the stack at the time. > > Removing the unnecessary if-condition fixes this, but add an explicit > memset of the tcs_cmd structure as well to ensure predictable behavior > if more tcs_cmd members are added in the future. > > Fixes: 976daac4a1c5 ("interconnect: qcom: Consolidate interconnect RPMh support") > Signed-off-by: Mike Tipton Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/interconnect/qcom/bcm-voter.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c > index 2adfde8cdf19..2a11a63e7217 100644 > --- a/drivers/interconnect/qcom/bcm-voter.c > +++ b/drivers/interconnect/qcom/bcm-voter.c > @@ -96,6 +96,8 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y, > if (!cmd) > return; > > + memset(cmd, 0, sizeof(*cmd)); > + > if (vote_x == 0 && vote_y == 0) > valid = false; > > @@ -112,8 +114,7 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y, > * Set the wait for completion flag on command that need to be completed > * before the next command. > */ > - if (commit) > - cmd->wait = true; > + cmd->wait = commit; > } > > static void tcs_list_gen(struct list_head *bcm_list, int bucket, > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project