All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: hackyzh002 <hackyzh002@gmail.com>, alexander.deucher@amd.com
Cc: Xinhui.Pan@amd.com, linux-kernel@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	airlied@gmail.com, sumit.semwal@linaro.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v2 1/2] drm/radeon: Fix integer overflow in radeon_cs_parser_init
Date: Wed, 19 Apr 2023 10:59:18 +0200	[thread overview]
Message-ID: <655e2eb7-0cfa-a488-ddde-e2507073dced@amd.com> (raw)
In-Reply-To: <20230419085747.4720-1-hackyzh002@gmail.com>

Am 19.04.23 um 10:57 schrieb hackyzh002:
> The type of size is unsigned, if size is 0x40000000, there will be an
> integer overflow, size will be zero after size *= sizeof(uint32_t),
> will cause uninitialized memory to be referenced later
>
> Signed-off-by: hackyzh002 <hackyzh002@gmail.com>
> ---
>   drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
> index 46a27ebf4..8e12b406e 100644
> --- a/drivers/gpu/drm/radeon/radeon_cs.c
> +++ b/drivers/gpu/drm/radeon/radeon_cs.c
> @@ -270,7 +270,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
>   {
>   	struct drm_radeon_cs *cs = data;
>   	uint64_t *chunk_array_ptr;
> -	unsigned size, i;
> +	u64 size, i;

Ok, once more: Please only change the type of the "size" variable" and 
not the type of "i".

Otherwise the patch looks good to me,
Christian.

>   	u32 ring = RADEON_CS_RING_GFX;
>   	s32 priority = 0;
>   


WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <christian.koenig@amd.com>
To: hackyzh002 <hackyzh002@gmail.com>, alexander.deucher@amd.com
Cc: Xinhui.Pan@amd.com, linux-kernel@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	dri-devel@lists.freedesktop.org, sumit.semwal@linaro.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v2 1/2] drm/radeon: Fix integer overflow in radeon_cs_parser_init
Date: Wed, 19 Apr 2023 10:59:18 +0200	[thread overview]
Message-ID: <655e2eb7-0cfa-a488-ddde-e2507073dced@amd.com> (raw)
In-Reply-To: <20230419085747.4720-1-hackyzh002@gmail.com>

Am 19.04.23 um 10:57 schrieb hackyzh002:
> The type of size is unsigned, if size is 0x40000000, there will be an
> integer overflow, size will be zero after size *= sizeof(uint32_t),
> will cause uninitialized memory to be referenced later
>
> Signed-off-by: hackyzh002 <hackyzh002@gmail.com>
> ---
>   drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
> index 46a27ebf4..8e12b406e 100644
> --- a/drivers/gpu/drm/radeon/radeon_cs.c
> +++ b/drivers/gpu/drm/radeon/radeon_cs.c
> @@ -270,7 +270,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
>   {
>   	struct drm_radeon_cs *cs = data;
>   	uint64_t *chunk_array_ptr;
> -	unsigned size, i;
> +	u64 size, i;

Ok, once more: Please only change the type of the "size" variable" and 
not the type of "i".

Otherwise the patch looks good to me,
Christian.

>   	u32 ring = RADEON_CS_RING_GFX;
>   	s32 priority = 0;
>   


WARNING: multiple messages have this Message-ID (diff)
From: "Christian König" <christian.koenig@amd.com>
To: hackyzh002 <hackyzh002@gmail.com>, alexander.deucher@amd.com
Cc: Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch,
	sumit.semwal@linaro.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v2 1/2] drm/radeon: Fix integer overflow in radeon_cs_parser_init
Date: Wed, 19 Apr 2023 10:59:18 +0200	[thread overview]
Message-ID: <655e2eb7-0cfa-a488-ddde-e2507073dced@amd.com> (raw)
In-Reply-To: <20230419085747.4720-1-hackyzh002@gmail.com>

Am 19.04.23 um 10:57 schrieb hackyzh002:
> The type of size is unsigned, if size is 0x40000000, there will be an
> integer overflow, size will be zero after size *= sizeof(uint32_t),
> will cause uninitialized memory to be referenced later
>
> Signed-off-by: hackyzh002 <hackyzh002@gmail.com>
> ---
>   drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
> index 46a27ebf4..8e12b406e 100644
> --- a/drivers/gpu/drm/radeon/radeon_cs.c
> +++ b/drivers/gpu/drm/radeon/radeon_cs.c
> @@ -270,7 +270,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
>   {
>   	struct drm_radeon_cs *cs = data;
>   	uint64_t *chunk_array_ptr;
> -	unsigned size, i;
> +	u64 size, i;

Ok, once more: Please only change the type of the "size" variable" and 
not the type of "i".

Otherwise the patch looks good to me,
Christian.

>   	u32 ring = RADEON_CS_RING_GFX;
>   	s32 priority = 0;
>   


  reply	other threads:[~2023-04-19  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19  8:57 [PATCH v2 1/2] drm/radeon: Fix integer overflow in radeon_cs_parser_init hackyzh002
2023-04-19  8:57 ` hackyzh002
2023-04-19  8:57 ` hackyzh002
2023-04-19  8:59 ` Christian König [this message]
2023-04-19  8:59   ` Christian König
2023-04-19  8:59   ` Christian König

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=655e2eb7-0cfa-a488-ddde-e2507073dced@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hackyzh002@gmail.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    /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 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.