From: Rodrigo Siqueira Jordao <Rodrigo.Siqueira@amd.com>
To: Lenko Donchev <lenko.donchev@gmail.com>
Cc: "Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Pan, Xinhui" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amd/display: Use kcalloc() instead of kzalloc()
Date: Wed, 21 Feb 2024 16:04:18 -0700 [thread overview]
Message-ID: <bccf8567-1b5e-497f-9724-e858447216e6@amd.com> (raw)
In-Reply-To: <ZbYYpky2sb8p8hjx@nixos>
On 1/28/24 02:04, Lenko Donchev wrote:
> We are trying to get rid of all multiplications from allocation
> functions to prevent integer overflows. Here the multiplication is
> obviously safe, but using kcalloc() is more appropriate and improves
> readability. This patch has no effect on runtime behavior.
>
> Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
> Link: https://github.com/KSPP/linux/issues/162
>
> Signed-off-by: Lenko Donchev <lenko.donchev@gmail.com>
> ---
> drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c
> index 5c9a30211c10..b67cd78e7c58 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c
> @@ -164,7 +164,7 @@ static void dpcd_extend_address_range(
> if (new_addr_range.start != in_address || new_addr_range.end != end_address) {
> *out_address = new_addr_range.start;
> *out_size = ADDRESS_RANGE_SIZE(new_addr_range.start, new_addr_range.end);
> - *out_data = kzalloc(*out_size * sizeof(**out_data), GFP_KERNEL);
> + *out_data = kcalloc(*out_size, sizeof(**out_data), GFP_KERNEL);
> }
> }
>
lgtm,
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
prev parent reply other threads:[~2024-02-21 23:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 9:04 Lenko Donchev
2024-02-21 23:04 ` Rodrigo Siqueira Jordao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bccf8567-1b5e-497f-9724-e858447216e6@amd.com \
--to=rodrigo.siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=lenko.donchev@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®