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] [day] [month] [year] [list]
Message-ID: <CADnq5_M7rkXD704Wd4GoeLx5mPukqtBfT_PmYu3aWGHJGXeebg@mail.gmail.com>
Date:   Wed, 16 Jan 2019 17:04:06 -0500
From:   Alex Deucher <alexdeucher@...il.com>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     Harry Wentland <harry.wentland@....com>,
        Leo Li <sunpeng.li@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Christian König <christian.koenig@....com>,
        "David (ChunMing) Zhou" <David1.Zhou@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Maling list - DRI developers 
        <dri-devel@...ts.freedesktop.org>,
        amd-gfx list <amd-gfx@...ts.freedesktop.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: Replace kzalloc with kcalloc

On Tue, Jan 15, 2019 at 2:58 AM Gustavo A. R. Silva
<gustavo@...eddedor.com> wrote:
>
> Replace kzalloc() function with its 2-factor argument form, kcalloc().
>
> This patch replaces cases of:
>
>         kzalloc(a * b, gfp)
>
> with:
>         kcalloc(a, b, gfp)
>
> Also, improve the coding style and the use of sizeof during
> allocation by changing sizeof(struct dc_surface_update) and
> sizeof(struct dc_plane_state) to sizeof(*updates) and
> sizeof(*surfaces), correspondingly.
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index a3e65e457348..4c201de38329 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5782,11 +5782,14 @@ dm_determine_update_type_for_commit(struct dc *dc,
>         struct dm_crtc_state *new_dm_crtc_state, *old_dm_crtc_state;
>         struct dc_stream_status *status = NULL;
>
> -       struct dc_surface_update *updates = kzalloc(MAX_SURFACES * sizeof(struct dc_surface_update), GFP_KERNEL);
> -       struct dc_plane_state *surface = kzalloc(MAX_SURFACES * sizeof(struct dc_plane_state), GFP_KERNEL);
> +       struct dc_surface_update *updates;
> +       struct dc_plane_state *surface;
>         struct dc_stream_update stream_update;
>         enum surface_update_type update_type = UPDATE_TYPE_FAST;
>
> +       updates = kcalloc(MAX_SURFACES, sizeof(*updates), GFP_KERNEL);
> +       surface = kcalloc(MAX_SURFACES, sizeof(*surface), GFP_KERNEL);
> +
>         if (!updates || !surface) {
>                 DRM_ERROR("Plane or surface update failed to allocate");
>                 /* Set type to FULL to avoid crashing in DC*/
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ