lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 28 Oct 2023 06:18:15 +0530
From:   Yuran Pereira <yuran.pereira@...mail.com>
To:     Hamza Mahfooz <hamza.mahfooz@....com>
Cc:     "Lakha, Bhawanpreet" <Bhawanpreet.Lakha@....com>,
        "airlied@...il.com" <airlied@...il.com>,
        "Li, Sun peng (Leo)" <Sunpeng.Li@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>,
        "Siqueira, Rodrigo" <Rodrigo.Siqueira@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "Deucher, Alexander" <Alexander.Deucher@....com>,
        "Koenig, Christian" <Christian.Koenig@....com>,
        "linux-kernel-mentees@...ts.linuxfoundation.org" 
        <linux-kernel-mentees@...ts.linuxfoundation.org>
Subject: Re: [PATCH] drm/amdgpu: Fixes uninitialized variable usage in
 amdgpu_dm_setup_replay

Hello,
On Fri, Oct 27, 2023 at 11:57:45AM -0400, Hamza Mahfooz wrote:
> On 10/27/23 11:55, Lakha, Bhawanpreet wrote:
> > [AMD Official Use Only - General]
> > 
> > 
> > 
> > There was a consensus to use memset instead of {0}. I remember making
> > changes related to that previously.
> 
> Hm, seems like it's used rather consistently in the DM and in DC
> though.
> 
Have you decided which one should be used?

Should I submit a v2 patch using {0} instead of memset?


Yuran Pereira
> > 
> > Bhawan
> > 
> > ------------------------------------------------------------------------
> > *From:* Mahfooz, Hamza <Hamza.Mahfooz@....com>
> > *Sent:* October 27, 2023 11:53 AM
> > *To:* Yuran Pereira <yuran.pereira@...mail.com>; airlied@...il.com
> > <airlied@...il.com>
> > *Cc:* Li, Sun peng (Leo) <Sunpeng.Li@....com>; Lakha, Bhawanpreet
> > <Bhawanpreet.Lakha@....com>; Pan, Xinhui <Xinhui.Pan@....com>; Siqueira,
> > Rodrigo <Rodrigo.Siqueira@....com>; linux-kernel@...r.kernel.org
> > <linux-kernel@...r.kernel.org>; amd-gfx@...ts.freedesktop.org
> > <amd-gfx@...ts.freedesktop.org>; dri-devel@...ts.freedesktop.org
> > <dri-devel@...ts.freedesktop.org>; Deucher, Alexander
> > <Alexander.Deucher@....com>; Koenig, Christian
> > <Christian.Koenig@....com>;
> > linux-kernel-mentees@...ts.linuxfoundation.org
> > <linux-kernel-mentees@...ts.linuxfoundation.org>
> > *Subject:* Re: [PATCH] drm/amdgpu: Fixes uninitialized variable usage in
> > amdgpu_dm_setup_replay
> > On 10/26/23 17:25, Yuran Pereira wrote:
> > > Since `pr_config` is not initialized after its declaration, the
> > > following operations with `replay_enable_option` may be performed
> > > when `replay_enable_option` is holding junk values which could
> > > possibly lead to undefined behaviour
> > > 
> > > ```
> > >       ...
> > >       pr_config.replay_enable_option |= pr_enable_option_static_screen;
> > >       ...
> > > 
> > >       if (!pr_config.replay_timing_sync_supported)
> > >           pr_config.replay_enable_option &= ~pr_enable_option_general_ui;
> > >       ...
> > > ```
> > > 
> > > This patch initializes `pr_config` after its declaration to ensure that
> > > it doesn't contain junk data, and prevent any undefined behaviour
> > > 
> > > Addresses-Coverity-ID: 1544428 ("Uninitialized scalar variable")
> > > Fixes: dede1fea4460 ("drm/amd/display: Add Freesync Panel DM code")
> > > Signed-off-by: Yuran Pereira <yuran.pereira@...mail.com>
> > > ---
> > >    drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c | 3 +++
> > >    1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c
> > > index 32d3086c4cb7..40526507f50b 100644
> > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c
> > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c
> > > @@ -23,6 +23,7 @@
> > >     *
> > >     */
> > > +#include <linux/string.h>
> > >    #include "amdgpu_dm_replay.h"
> > >    #include "dc.h"
> > >    #include "dm_helpers.h"
> > > @@ -74,6 +75,8 @@ bool amdgpu_dm_setup_replay(struct dc_link *link, struct amdgpu_dm_connector *ac
> > >         struct replay_config pr_config;
> > 
> > I would prefer setting pr_config = {0};
> > 
> > >         union replay_debug_flags *debug_flags = NULL;
> > > +     memset(&pr_config, 0, sizeof(pr_config));
> > > +
> > >         // For eDP, if Replay is supported, return true to skip checks
> > >         if (link->replay_settings.config.replay_supported)
> > >                 return true;
> > -- 
> > Hamza
> > 
> -- 
> Hamza
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ