public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* Coverity: dm_dmub_sw_init(): Incorrect expression
@ 2023-01-12 22:25 coverity-bot
  2023-01-12 22:39 ` Limonciello, Mario
  0 siblings, 1 reply; 3+ messages in thread
From: coverity-bot @ 2023-01-12 22:25 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: linux-kernel, amd-gfx, Rodrigo Siqueira, Leo Li, Roman Li,
	Fangzhi Zuo, hersen wu, dri-devel, Christian König,
	Lijo Lazar, Aurabindo Pillai, Harry Wentland, Alex Deucher,
	Daniel Vetter, David Airlie, Pan, Xinhui, Daniel Wheeler,
	Gustavo A. R. Silva, linux-next, linux-hardening

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20230111 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Tue Jan 10 14:32:57 2023 -0500
    a7ab345149b8 ("drm/amd/display: Load DMUB microcode during early_init")

Coverity reported the following:

*** CID 1530544:  Incorrect expression  (IDENTICAL_BRANCHES)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1951 in dm_dmub_sw_init()
1945
1946     	switch (adev->ip_versions[DCE_HWIP][0]) {
1947     	case IP_VERSION(2, 1, 0):
1948     		dmub_asic = DMUB_ASIC_DCN21;
1949     		break;
1950     	case IP_VERSION(3, 0, 0):
vvv     CID 1530544:  Incorrect expression  (IDENTICAL_BRANCHES)
vvv     The same code is executed regardless of whether "adev->ip_versions[GC_HWIP][0] == 656128U" is true, because the 'then' and 'else' branches are identical. Should one of the branches be modified, or the entire 'if' statement replaced?
1951     		if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
1952     			dmub_asic = DMUB_ASIC_DCN30;
1953     		else
1954     			dmub_asic = DMUB_ASIC_DCN30;
1955     		break;
1956     	case IP_VERSION(3, 0, 1):

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1530544 ("Incorrect expression")
Fixes: a7ab345149b8 ("drm/amd/display: Load DMUB microcode during early_init")

Thanks for your attention!

-- 
Coverity-bot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Coverity: dm_dmub_sw_init(): Incorrect expression
  2023-01-12 22:25 Coverity: dm_dmub_sw_init(): Incorrect expression coverity-bot
@ 2023-01-12 22:39 ` Limonciello, Mario
  2023-01-12 22:45   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Limonciello, Mario @ 2023-01-12 22:39 UTC (permalink / raw)
  To: coverity-bot
  Cc: linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	Siqueira, Rodrigo, Li, Sun peng (Leo), Li, Roman, Zuo, Jerry,
	Wu, Hersen, dri-devel@lists.freedesktop.org, Koenig, Christian,
	Lazar, Lijo, Pillai, Aurabindo, Wentland, Harry,
	Deucher, Alexander, Daniel Vetter, David Airlie, Pan, Xinhui,
	Wheeler, Daniel, Gustavo A. R. Silva, linux-next@vger.kernel.org,
	linux-hardening@vger.kernel.org

[AMD Official Use Only - General]

This particular one was fixed already in https://patchwork.freedesktop.org/patch/518050/ which got applied today.

> -----Original Message-----
> From: coverity-bot <keescook@chromium.org>
> Sent: Thursday, January 12, 2023 16:25
> To: Limonciello, Mario <Mario.Limonciello@amd.com>
> Cc: linux-kernel@vger.kernel.org; amd-gfx@lists.freedesktop.org; Siqueira,
> Rodrigo <Rodrigo.Siqueira@amd.com>; Li, Sun peng (Leo)
> <Sunpeng.Li@amd.com>; Li, Roman <Roman.Li@amd.com>; Zuo, Jerry
> <Jerry.Zuo@amd.com>; Wu, Hersen <hersenxs.wu@amd.com>; dri-
> devel@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>;
> Lazar, Lijo <Lijo.Lazar@amd.com>; Pillai, Aurabindo
> <Aurabindo.Pillai@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>;
> Deucher, Alexander <Alexander.Deucher@amd.com>; Daniel Vetter
> <daniel@ffwll.ch>; David Airlie <airlied@gmail.com>; Pan, Xinhui
> <Xinhui.Pan@amd.com>; Wheeler, Daniel <Daniel.Wheeler@amd.com>;
> Gustavo A. R. Silva <gustavo@embeddedor.com>; linux-next@vger.kernel.org;
> linux-hardening@vger.kernel.org
> Subject: Coverity: dm_dmub_sw_init(): Incorrect expression
> 
> Hello!
> 
> This is an experimental semi-automated report about issues detected by
> Coverity from a scan of next-20230111 as part of the linux-next scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
> 
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by commits:
> 
>   Tue Jan 10 14:32:57 2023 -0500
>     a7ab345149b8 ("drm/amd/display: Load DMUB microcode during early_init")
> 
> Coverity reported the following:
> 
> *** CID 1530544:  Incorrect expression  (IDENTICAL_BRANCHES)
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1951 in
> dm_dmub_sw_init()
> 1945
> 1946     	switch (adev->ip_versions[DCE_HWIP][0]) {
> 1947     	case IP_VERSION(2, 1, 0):
> 1948     		dmub_asic = DMUB_ASIC_DCN21;
> 1949     		break;
> 1950     	case IP_VERSION(3, 0, 0):
> vvv     CID 1530544:  Incorrect expression  (IDENTICAL_BRANCHES)
> vvv     The same code is executed regardless of whether "adev-
> >ip_versions[GC_HWIP][0] == 656128U" is true, because the 'then' and 'else'
> branches are identical. Should one of the branches be modified, or the entire 'if'
> statement replaced?
> 1951     		if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 0))
> 1952     			dmub_asic = DMUB_ASIC_DCN30;
> 1953     		else
> 1954     			dmub_asic = DMUB_ASIC_DCN30;
> 1955     		break;
> 1956     	case IP_VERSION(3, 0, 1):
> 
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
> 
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1530544 ("Incorrect expression")
> Fixes: a7ab345149b8 ("drm/amd/display: Load DMUB microcode during
> early_init")
> 
> Thanks for your attention!
> 
> --
> Coverity-bot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Coverity: dm_dmub_sw_init(): Incorrect expression
  2023-01-12 22:39 ` Limonciello, Mario
@ 2023-01-12 22:45   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2023-01-12 22:45 UTC (permalink / raw)
  To: Limonciello, Mario
  Cc: linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	Siqueira, Rodrigo, Li, Sun peng (Leo), Li, Roman, Zuo, Jerry,
	Wu, Hersen, dri-devel@lists.freedesktop.org, Koenig, Christian,
	Lazar, Lijo, Pillai, Aurabindo, Wentland, Harry,
	Deucher, Alexander, Daniel Vetter, David Airlie, Pan, Xinhui,
	Wheeler, Daniel, Gustavo A. R. Silva, linux-next@vger.kernel.org,
	linux-hardening@vger.kernel.org

On Thu, Jan 12, 2023 at 10:39:20PM +0000, Limonciello, Mario wrote:
> This particular one was fixed already in https://patchwork.freedesktop.org/patch/518050/ which got applied today.

Ah-ha; thanks!

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-12 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-12 22:25 Coverity: dm_dmub_sw_init(): Incorrect expression coverity-bot
2023-01-12 22:39 ` Limonciello, Mario
2023-01-12 22:45   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox