Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp32142pxb; Wed, 24 Feb 2021 17:18:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJygXaHktFO059PbykkmVbUrIHWQXZbfsjJddWfjbe2Zpmqyi8lOuHxof2ZpE5PUCR4m28bH X-Received: by 2002:a17:907:20bb:: with SMTP id pw27mr357608ejb.71.1614215893799; Wed, 24 Feb 2021 17:18:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614215893; cv=none; d=google.com; s=arc-20160816; b=1K1Hjppa+r3u+UypdpycHKqFgdkwVNVntVXgCnPvzAa+XJDosVZmz1/2IFaS79V77J HooaoqI4JGBi5pcK6LoaLlg4MzKtDXC5x3jGI7cHGPJajM9lnr0yyOO/e16BAQYLTTdP rXWNd9sxtPQkF44HG8JtseTjbS4DW46qcZmsWl1KC120MxIqsEkwN7xKL2VktURfEr3J 9cJGsdXWuFHFJkuhkORVx9b/2Eypy7W3r152PngOVUrl1Gtewj6mBdI3XCmcUOPw4Ikn YxZ9yhw8U0/v16LsN6vKVJYsb8UBZ4q8f6O04B8Sfvx0dAP4tun24afyzSieaquqUgQO 5pwA== 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:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=KVEFF/e3cq8hSLAqkkWzb/tsBUvxw8HxL0663tRmoQo=; b=TjBG5ffn/M4L6SFtSscyxoXgAnmhRphVRCupmikO+nMXuY74yaaETnOUfEi0q8W7Oy 1Ctpe2LAYOyL/Da0bTi7epkUq8ZDRSntr7j/+GhyLxM1tK/wSB6XnkHSthIMFondlfSi P+pgnvdG2seE0wT3k6HL5sKyeCVj9IgZPz/73bJS2t3PcwDL8zhFJn6nbYhM0qQy1OPX m/4VPHiVzXVtaGF+aUeK6CDeCrhOgb6Gld+vA5JuOSDs3lxELWAvYGzuDxgmVMsls95r WM6x3uBGdfaAtC8v0VFI/IqDdoLcXeYBEUb57Qsn4EP6HIEPvt6gwWz8PaZlINN/GxHl f8mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rYBE3tx4; 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 gf2si2451793ejb.736.2021.02.24.17.17.47; Wed, 24 Feb 2021 17:18:13 -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=rYBE3tx4; 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 S235045AbhBXRlE (ORCPT + 99 others); Wed, 24 Feb 2021 12:41:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbhBXRlB (ORCPT ); Wed, 24 Feb 2021 12:41:01 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E80DC06174A for ; Wed, 24 Feb 2021 09:40:21 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id i18so2421752ilq.13 for ; Wed, 24 Feb 2021 09:40:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=KVEFF/e3cq8hSLAqkkWzb/tsBUvxw8HxL0663tRmoQo=; b=rYBE3tx41p3vC7kUwVnZVOt8IudcouNv90aVHp5aRhAJWTwWstiIG9UaRmHFnBkT1J U24fewXNjZGiaZFhZpq2ulihxcffmastRktVQy01PCBiB0hV5Cns2qWgzjvMr3b9EU7k 7XcN6DV9zH3YcToGb6XW27xkxP6Y2joVmWEVJS0m83PlcBp/DY0IawGND8xawJA+4Fwq lZhMZvy6HTWMHwcbp1cPGDjsnr591C0nHLhw1Q5L8I/hgf9LLjcSUFGDZBlNpJOleUki HlKTFrumpxZPh7ICSMsxUmo5wRAeraFG4DAyIMeNb4NSZWcsNG/c01XghtRuzsus7PjG OiEQ== 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:reply-to :from:date:message-id:subject:to:cc; bh=KVEFF/e3cq8hSLAqkkWzb/tsBUvxw8HxL0663tRmoQo=; b=X3aMM4KxgJ1qaGGmtDOmELlGu0K/BCjdwswbeos9jCu/1dGzcjjS5TBo00W1oG7Mdm Ogb08HrVygWtqJwkONVLG2ZHLj42zdJT3utVz3QB2IWa7OvlLeGKGtdjEmek6yRHCdzn 7xqYSSeJkksdp/YqSVIIfmsaHGXeUW5vXxvPcAEaT4t8pjytKodFj6G/RucTT+ywYTPP 85FVlav6HKAuYuJYp5VHHm7N4GoqQmHqk+aFTQplFjGIWPlg4C1uahQzOD6fgUu9aNre yiau+IP7uoL92IbwzWGzD9jh5IJVUWWqaBXVTWArR6QljQnKlxlsy1MEPU2LNCK/0fD1 wlcA== X-Gm-Message-State: AOAM532D0wVlh8DCvAhRx2+bs5KFgrk8OivierHcEtsRGH05uoDwnPsC cbcVPFKdUtRSuGy7+6zQlEtAJoqun74eiRuntDw= X-Received: by 2002:a92:c145:: with SMTP id b5mr19179398ilh.186.1614188420558; Wed, 24 Feb 2021 09:40:20 -0800 (PST) MIME-Version: 1.0 References: <20210218224849.5591-1-nathan@kernel.org> In-Reply-To: <20210218224849.5591-1-nathan@kernel.org> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Wed, 24 Feb 2021 18:40:09 +0100 Message-ID: Subject: Re: [PATCH] drm/amd/pm/swsmu: Avoid using structure_size uninitialized in smu_cmn_init_soft_gpu_metrics To: Nathan Chancellor Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , Nick Desaulniers , Kevin Wang , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Clang-Built-Linux ML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2021 at 11:49 PM Nathan Chancellor wrote: > > Clang 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; > ^ > = 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 I fell over this today with Linux v5.11-10201-gc03c21ba6f4e. Tested-by: Sedat Dilek # LLVM/Clang v13-git - Sedat - > --- > 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/amd/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, uint8_t frev, uint8_t crev) > structure_size = sizeof(struct gpu_metrics_v2_0); > break; > default: > - break; > + return; > } > > #undef METRICS_VERSION > -- > 2.30.1 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20210218224849.5591-1-nathan%40kernel.org.