Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5931283pxb; Mon, 14 Feb 2022 11:01:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJznscldswfGYxsOv+2czC6LFGmrG4wrhLIWhaZVQJNFL/0AxsNCm5sWOX2xr+ZDvVKpyjry X-Received: by 2002:a05:6a00:130f:: with SMTP id j15mr245180pfu.25.1644865267983; Mon, 14 Feb 2022 11:01:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644865267; cv=none; d=google.com; s=arc-20160816; b=uPEyfRC3R6DXWfSm8LQEWe6Ayqb82r9JBO1JsuaZsw+cQ6vPE4UUHCfTkM4JjhUYrW kzI1Cldun+7ozMs4ICfLehjkIxiGXBlqFmyKaQxmQp92EobH2CZ7UTSBxBzn7XQ9YxD9 +pIZNgV+GwdTP7RVib4PzeTG79NBp1kWpjpbwefUvRYtvJyosyFTfbSqORwEalpNtw17 xZRLIltSVXGAKe9n8vDVlhzvCoThDODEHyMyDfcSDEiPya1U30j7pHEVVekDU1COzrBn vdqhNe7X5ihVe5SsFf44Xv6TG91w3xKDiyxEK8lmdPqrGuilWcMNyCuZcoB26moUQ/ns zS6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QlSvtvFbST+JRiZy0nw8qsurosZlPyiaBzL4u9A7NPg=; b=mFGOjmnvV17f+oI972VSxum5BJyEDgPmZiVEwG9Q+kDI6YFZdputEOT2pK0R1+FBY0 xHm+6BhWxUKUAcLaYQ/652SqJ/1E0Qr8ukFUUi58Vw8Q3RPzeLn4t6S26yog4vnqtRSr J5YVYE3CLg4ql1OFB41whZ0zL3iXxNrehnl5rlBerU1r4RwNOET1k6k0PFdO1IlRS6zm yd+PaN4lZ7KRVLy84OLKLvp2hannQPcG3YmbgrbFDYaWAtWbe9cQuroPKnmQMcg6TbOH ZIKarOKBMeKBHcB2la2km2U7nCFMj72IXc0OEhKRAs0QhVs4PSuuVNgylKcKfOY5EwHu 2oRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="HXqACW//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id na14si3935425pjb.16.2022.02.14.11.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:01:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="HXqACW//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 24EA6D9941; Mon, 14 Feb 2022 10:59:21 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245756AbiBNS0Q (ORCPT + 99 others); Mon, 14 Feb 2022 13:26:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbiBNS0P (ORCPT ); Mon, 14 Feb 2022 13:26:15 -0500 Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99979488B6 for ; Mon, 14 Feb 2022 10:26:06 -0800 (PST) Received: by mail-oo1-xc33.google.com with SMTP id c7-20020a4ad207000000b002e7ab4185d2so20298784oos.6 for ; Mon, 14 Feb 2022 10:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QlSvtvFbST+JRiZy0nw8qsurosZlPyiaBzL4u9A7NPg=; b=HXqACW//Zm0115qK79VxKxElAYlr95AzBf3cBr6QuimTb9boq0VaCrFqwmZvXHTKI0 wKgj5UvN50iY0OiyrcX6/VJPFTxIBdus86P9uDgMpY7COalhtCiMDuUuNkmlHbDOMFVb 7c/d/mm4z92AXKDl1cngznbb7e/JgfyeqwLfiV4dnWnr9nBwruWYPE1VizPeGLJfYvWI 7NwGpT7iZsmEYd4jGbrlyV5wgk4jv2b7smJtuJ3GDbWT+eRbKGnewN7kUrlHZD7B1AEI Oiq83ESXQFphER2f1zpQGtfPQD7KZuYuCSsMt7OAkw/q8fXEk03RR3RKro0Ww3Cc5fwz yx2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QlSvtvFbST+JRiZy0nw8qsurosZlPyiaBzL4u9A7NPg=; b=g+klEM2ZHGeq+Ok0QAlmXuEn7c2kOFfXQ3GcKSw37IqOavMiuxRbn7Z+ivhtEsJQIZ 0lRmxCd7ff3PyKLZNAPQxlVPnT6b9RTV1g9rYQH310YFAmxP28gRsYiJTeMbygiYuRWx E/Qn/SB6DQm+D7DcyHa0HOHPXmYjTLOPlsi+dJ/3oLsktJmx6fUl2pW4DaINstkLZf0P DgnOw63ZsiAckPNx3OL3n9uss+DI6YPDv8x94aehnn+DO7njZfI/4na5C+WfxPSDdmyz 9PIHBr/taJ9D9EfTF/eMlabopg7JiAEcPFvTWxoer7R5m90XoN6HlpmSW8f9uU3rgcLH i4CA== X-Gm-Message-State: AOAM532/CUrGC5lfsH/HeeeTEGFbAFJ9eRF/+o5e/IBMz9XgGa3GPplm QWfIzMd22d/sbc1n7e6SYM3bW1dnvLSRTUb8z9g= X-Received: by 2002:a4a:d583:: with SMTP id z3mr20564oos.68.1644863166025; Mon, 14 Feb 2022 10:26:06 -0800 (PST) MIME-Version: 1.0 References: <20220214182224.2906060-1-trix@redhat.com> In-Reply-To: <20220214182224.2906060-1-trix@redhat.com> From: Alex Deucher Date: Mon, 14 Feb 2022 13:25:55 -0500 Message-ID: Subject: Re: [PATCH] drm/amdgpu: check return status before using stable_pstate To: Tom Rix Cc: "Deucher, Alexander" , Christian Koenig , xinhui pan , Dave Airlie , Daniel Vetter , Nathan Chancellor , Nick Desaulniers , "Tuikov, Luben" , "Nieto, David M" , Nirmoy Das , "Xue, Ken" , Roy Sun , "Quan, Evan" , llvm@lists.linux.dev, Maling list - DRI developers , amd-gfx list , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Applied. Thanks! Alex On Mon, Feb 14, 2022 at 1:22 PM wrote: > > From: Tom Rix > > Clang static analysis reports this problem > amdgpu_ctx.c:616:26: warning: Assigned value is garbage > or undefined > args->out.pstate.flags = stable_pstate; > ^ ~~~~~~~~~~~~~ > amdgpu_ctx_stable_pstate can fail without setting > stable_pstate. So check. > > Fixes: 8cda7a4f96e4 ("drm/amdgpu/UAPI: add new CTX OP to get/set stable pstates") > Signed-off-by: Tom Rix > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > index 1c72f6095f08..f522b52725e4 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > @@ -613,7 +613,8 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, > if (args->in.flags) > return -EINVAL; > r = amdgpu_ctx_stable_pstate(adev, fpriv, id, false, &stable_pstate); > - args->out.pstate.flags = stable_pstate; > + if (!r) > + args->out.pstate.flags = stable_pstate; > break; > case AMDGPU_CTX_OP_SET_STABLE_PSTATE: > if (args->in.flags & ~AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK) > -- > 2.26.3 >