From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: "Harry Wentland" <harry.wentland@amd.com>, "Leo Li" <sunpeng.li@amd.com>, "Rodrigo Siqueira" <Rodrigo.Siqueira@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> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/amd/display: Correctly initialize some memory in get_available_dsc_slices() Date: Tue, 25 Apr 2023 09:53:34 +0200 [thread overview] Message-ID: <f7953bb41b7d5e28ec6bc3abfa06c8aaa0193ca4.1682409190.git.christophe.jaillet@wanadoo.fr> (raw) The intent here is to clear the 'available_slices' buffer before setting some values in it. This is an array of int, so in order to fully initialize it, we must clear MIN_AVAILABLE_SLICES_SIZE * sizeof(int) bytes. Compute the right length of the buffer when calling memset(). Fixes: 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- NOT even compile-tested. make -j7 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.o on my setup, it fails with: CC drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.o drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c:27:10: fatal error: dc_hw_types.h: Aucun fichier ou dossier de ce type 27 | #include "dc_hw_types.h" | ^~~~~~~~~~~~~~~ I've not investigated why. --- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c index b9a05bb025db..1d7384b2be28 100644 --- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c @@ -645,7 +645,7 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av { int idx = 0; - memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE); + memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE * sizeof(*available_slices)); if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] = 1; -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: "Harry Wentland" <harry.wentland@amd.com>, "Leo Li" <sunpeng.li@amd.com>, "Rodrigo Siqueira" <Rodrigo.Siqueira@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> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>, dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org Subject: [PATCH] drm/amd/display: Correctly initialize some memory in get_available_dsc_slices() Date: Tue, 25 Apr 2023 09:53:34 +0200 [thread overview] Message-ID: <f7953bb41b7d5e28ec6bc3abfa06c8aaa0193ca4.1682409190.git.christophe.jaillet@wanadoo.fr> (raw) The intent here is to clear the 'available_slices' buffer before setting some values in it. This is an array of int, so in order to fully initialize it, we must clear MIN_AVAILABLE_SLICES_SIZE * sizeof(int) bytes. Compute the right length of the buffer when calling memset(). Fixes: 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- NOT even compile-tested. make -j7 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.o on my setup, it fails with: CC drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.o drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c:27:10: fatal error: dc_hw_types.h: Aucun fichier ou dossier de ce type 27 | #include "dc_hw_types.h" | ^~~~~~~~~~~~~~~ I've not investigated why. --- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c index b9a05bb025db..1d7384b2be28 100644 --- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c @@ -645,7 +645,7 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av { int idx = 0; - memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE); + memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE * sizeof(*available_slices)); if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] = 1; -- 2.34.1
next reply other threads:[~2023-04-25 7:53 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-25 7:53 Christophe JAILLET [this message] 2023-04-25 7:53 ` [PATCH] drm/amd/display: Correctly initialize some memory in get_available_dsc_slices() Christophe JAILLET 2023-04-26 17:28 ` Hamza Mahfooz 2023-04-26 17:28 ` Hamza Mahfooz
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=f7953bb41b7d5e28ec6bc3abfa06c8aaa0193ca4.1682409190.git.christophe.jaillet@wanadoo.fr \ --to=christophe.jaillet@wanadoo.fr \ --cc=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=kernel-janitors@vger.kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.