Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1885399pxb; Mon, 22 Feb 2021 13:41:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBjyEQi0ksjnnjSJJF8Ajs1ECf9smP2slnO/8QeUC1gXkFgfncVnsjW7AkJCjbS9gVStGs X-Received: by 2002:a50:8b66:: with SMTP id l93mr24145949edl.384.1614030081199; Mon, 22 Feb 2021 13:41:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614030081; cv=none; d=google.com; s=arc-20160816; b=nNvDjT5ITolOyhhyQEqmk5nG0Z9by3HO9pujilChvfH6fj+21u+EYPjbdD8NMv726Z WBtR/94NLTaiS4f9G+sodHVARSr6Ycx7Hi+HpOUhZVICTKm0ooDkhq4yU59Q0b1MhMaj RXvVOBFQgTyEa9q97RR6nEoLemC4uOFxxRuI8URShLuKtXWvbzG1sEyDqKMdgyY+/Poz 8FqXDMcS6HLmWY4HrgvrAcdhPJTrRYkI5KC+pdMhB3+4KAcSAVGtM0qi9hLwP+zpWty+ eCExkzCV8Fn5DjirP7JjNMmrQQ3xi2lHtZNPwCUTkG6Vs60vY2dsHEgERaydfPW/ULLI dhiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BdA4QMTkvcuLnrvRLDVtBXvNd3HImh3DqClB8gl/vNc=; b=CZ9y5H5s6G0v2hRghKHPGgbOMQzOazSzwg3neui00Y98NXwA8nGTl4IvwO+U0Ow7Vv W5P7YzJg+bSSCDO931vT+NeaN267EKH9TH9Biwmp3Sgc+OCOd0eWGHol676ISbktqHZi eKhMmPqxRquYsLfTLOfD1DFLHMywhuWZ10P7XcPXvnp1snPyE0wsMbM5Dsqtoqc+xBag CroEDlqortIVxKd8QIVuuqd8aTzQ73LIpHdW1oCBO8kY7LZslnlNIeDcbzUNtrMg2q8o Koi5QRAL47bbFJM+ahbSnh+jz2YP+/48jQ/kUOsB5cpySWFkusQ09gmf1Yidoedp3NFd zRNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jV8vA8ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si14055965ejd.83.2021.02.22.13.40.57; Mon, 22 Feb 2021 13:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jV8vA8ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232316AbhBVVjm (ORCPT + 99 others); Mon, 22 Feb 2021 16:39:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbhBVVjP (ORCPT ); Mon, 22 Feb 2021 16:39:15 -0500 Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B8BAC061574 for ; Mon, 22 Feb 2021 13:38:35 -0800 (PST) Received: by mail-oo1-xc35.google.com with SMTP id p6so247505oot.2 for ; Mon, 22 Feb 2021 13:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=BdA4QMTkvcuLnrvRLDVtBXvNd3HImh3DqClB8gl/vNc=; b=jV8vA8ffi1Ah+DtRGWB7+I7T3WuB40v2z1tztQc7a5uWHrAuMzNGfroESOSWu0WcZ2 dBrkXBgxKWwtmiOZid6iaruXrpyvamrAQGEO9dDUhjpWN1ZcsDJwHgKjoQ9NYAdRKnSi RPFBYbriX9O6Zxs0SJq1zO9hktkIwTJGeil6WNtGvDu9KaKcjIX9rY6Qu2nBRLyrD1cV lZYzZK+F/92Bsm0yG5chEGmK3ONt3oPcv6Xg95Clm3ck5D+p0EAXk2ePe42QTWZ4eGCR K/p/1HqvxqQpebi+I2zdi33AFxdpKZsSXJajhWuoFgx4mVJuRNv4Ot5f7zxbw1uXnqgi G+7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BdA4QMTkvcuLnrvRLDVtBXvNd3HImh3DqClB8gl/vNc=; b=cHpfahi66nGrpiGsxDOpX5yr/vDcW1put8ee8kqfgyyDKCPIiT4yEnlpYT8i5Onwt2 4w3khb6chOV9RJZK2mOYEXZ2RQGulqrYWvRrn15SOCyAtcTQZclcGCu+R18ut+PrInJ1 NUQRadieb13r5INP83JbYpYZLzRc6ieZQilte0SZytvEvnnGlFrFGhHnAg+ZEzD2riTY WNVMBytTfcSLU1HjBgRdhU+LjdPKiqEsPWm/Ysbxyk2QzLXBM7Co3xkHfee4P1U1gSTI eCUXoVlwbDrzA7858HuLmD/u6D2KeYcHd1ma0DO/OUEBvI7LP7UqyYT3ipG6S0hAE8ow WEow== X-Gm-Message-State: AOAM532NOZBk7KkVs8UzxLl2vh+Rb+iYrpqEl1iPz7NTWT3MBk4yxZ0U xqKc+NCvcIwq6lWMycLy2CY1Pgja3SuBUU9FXmI2m14Y X-Received: by 2002:a4a:9801:: with SMTP id y1mr1728430ooi.90.1614029914834; Mon, 22 Feb 2021 13:38:34 -0800 (PST) MIME-Version: 1.0 References: <20210218224849.5591-1-nathan@kernel.org> In-Reply-To: From: Alex Deucher Date: Mon, 22 Feb 2021 16:38:23 -0500 Message-ID: Subject: Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics To: "Wang, Kevin(Yang)" Cc: Nathan Chancellor , Nick Desaulniers , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "clang-built-linux@googlegroups.com" , "amd-gfx@lists.freedesktop.org" , "Deucher, Alexander" , "Koenig, Christian" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Applied. Thanks! Alex On Thu, Feb 18, 2021 at 6:12 PM Wang, Kevin(Yang) wro= te: > > thanks, > > Reviewed-by: Kevin Wang > > Regards, > Kevin > > > =E5=9C=A8 2021=E5=B9=B42=E6=9C=8819=E6=97=A5=EF=BC=8C06:49=EF=BC=8CNath= an Chancellor =E5=86=99=E9=81=93=EF=BC=9A > > > > =EF=BB=BFClang warns: > > > > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:764:2: warning: > > variable 'structure_size' is used uninitialized whenever switch default > > is taken [-Wsometimes-uninitialized] > > default: > > ^~~~~~~ > > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:770:23: note: > > uninitialized use occurs here > > memset(header, 0xFF, structure_size); > > ^~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu_cmn.c:753:25: note: > > initialize the variable 'structure_size' to silence this warning > > uint16_t structure_size; > > ^ > > =3D 0 > > 1 warning generated. > > > > Return in the default case, as the size of the header will not be known= . > > > > Fixes: de4b7cd8cb87 ("drm/amd/pm/swsmu: unify the init soft gpu metrics= function") > > Link: https://github.com/ClangBuiltLinux/linux/issues/1304 > > Signed-off-by: Nathan Chancellor > > --- > > drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/a= md/pm/swsmu/smu_cmn.c > > index bb620fdd4cd2..bcedd4d92e35 100644 > > --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c > > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c > > @@ -762,7 +762,7 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uin= t8_t frev, uint8_t crev) > > structure_size =3D sizeof(struct gpu_metrics_v2_0); > > break; > > default: > > - break; > > + return; > > } > > > > #undef METRICS_VERSION > > -- > > 2.30.1 > > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx