* [PATCH v3] drm: Fix potential overflow issue in event_string array
@ 2025-04-09 1:46 jiangfeng
2025-04-09 4:03 ` André Almeida
2025-04-09 6:24 ` Raag Jadav
0 siblings, 2 replies; 5+ messages in thread
From: jiangfeng @ 2025-04-09 1:46 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, simona,
rodrigo.vivi, raag.jadav, andrealmeid, christian.koenig
Cc: dri-devel, linux-kernel, Feng Jiang
From: Feng Jiang <jiangfeng@kylinos.cn>
When calling scnprintf() to append recovery method to event_string,
the second argument should be `sizeof(event_string) - len`, otherwise
there is a potential overflow problem.
Fixes: b7cf9f4ac1b8 ("drm: Introduce device wedged event")
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
---
v3:
- update the subject
v2:
- update commit message
- keep scnprintf() as a single line
---
drivers/gpu/drm/drm_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 17fc5dc708f4..60e5ac179c15 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -549,7 +549,7 @@ int drm_dev_wedged_event(struct drm_device *dev, unsigned long method)
if (drm_WARN_ONCE(dev, !recovery, "invalid recovery method %u\n", opt))
break;
- len += scnprintf(event_string + len, sizeof(event_string), "%s,", recovery);
+ len += scnprintf(event_string + len, sizeof(event_string) - len, "%s,", recovery);
}
if (recovery)
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v3] drm: Fix potential overflow issue in event_string array
2025-04-09 1:46 [PATCH v3] drm: Fix potential overflow issue in event_string array jiangfeng
@ 2025-04-09 4:03 ` André Almeida
2025-04-09 6:24 ` Raag Jadav
1 sibling, 0 replies; 5+ messages in thread
From: André Almeida @ 2025-04-09 4:03 UTC (permalink / raw)
To: jiangfeng
Cc: mripard, christian.koenig, rodrigo.vivi, dri-devel, raag.jadav,
simona, maarten.lankhorst, linux-kernel, tzimmermann, airlied
Em 08/04/2025 22:46, jiangfeng@kylinos.cn escreveu:
> From: Feng Jiang <jiangfeng@kylinos.cn>
>
> When calling scnprintf() to append recovery method to event_string,
> the second argument should be `sizeof(event_string) - len`, otherwise
> there is a potential overflow problem.
>
> Fixes: b7cf9f4ac1b8 ("drm: Introduce device wedged event")
> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] drm: Fix potential overflow issue in event_string array
2025-04-09 1:46 [PATCH v3] drm: Fix potential overflow issue in event_string array jiangfeng
2025-04-09 4:03 ` André Almeida
@ 2025-04-09 6:24 ` Raag Jadav
2025-05-01 12:22 ` Raag Jadav
1 sibling, 1 reply; 5+ messages in thread
From: Raag Jadav @ 2025-04-09 6:24 UTC (permalink / raw)
To: jiangfeng
Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona,
rodrigo.vivi, andrealmeid, christian.koenig, dri-devel,
linux-kernel
On Wed, Apr 09, 2025 at 09:46:33AM +0800, jiangfeng@kylinos.cn wrote:
> From: Feng Jiang <jiangfeng@kylinos.cn>
>
> When calling scnprintf() to append recovery method to event_string,
> the second argument should be `sizeof(event_string) - len`, otherwise
> there is a potential overflow problem.
>
> Fixes: b7cf9f4ac1b8 ("drm: Introduce device wedged event")
> Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Thanks for the fix.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] drm: Fix potential overflow issue in event_string array
2025-04-09 6:24 ` Raag Jadav
@ 2025-05-01 12:22 ` Raag Jadav
2025-05-02 13:35 ` Rodrigo Vivi
0 siblings, 1 reply; 5+ messages in thread
From: Raag Jadav @ 2025-05-01 12:22 UTC (permalink / raw)
To: jiangfeng
Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona,
rodrigo.vivi, andrealmeid, christian.koenig, dri-devel,
linux-kernel
On Wed, Apr 09, 2025 at 09:24:41AM +0300, Raag Jadav wrote:
> On Wed, Apr 09, 2025 at 09:46:33AM +0800, jiangfeng@kylinos.cn wrote:
> > From: Feng Jiang <jiangfeng@kylinos.cn>
> >
> > When calling scnprintf() to append recovery method to event_string,
> > the second argument should be `sizeof(event_string) - len`, otherwise
> > there is a potential overflow problem.
> >
> > Fixes: b7cf9f4ac1b8 ("drm: Introduce device wedged event")
> > Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
>
> Reviewed-by: Raag Jadav <raag.jadav@intel.com>
>
> Thanks for the fix.
This one seems got lost in the noise but important for 6.15.
Any takers?
Raag
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v3] drm: Fix potential overflow issue in event_string array
2025-05-01 12:22 ` Raag Jadav
@ 2025-05-02 13:35 ` Rodrigo Vivi
0 siblings, 0 replies; 5+ messages in thread
From: Rodrigo Vivi @ 2025-05-02 13:35 UTC (permalink / raw)
To: Raag Jadav
Cc: jiangfeng, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, andrealmeid, christian.koenig, dri-devel, linux-kernel
On Thu, May 01, 2025 at 03:22:25PM +0300, Raag Jadav wrote:
> On Wed, Apr 09, 2025 at 09:24:41AM +0300, Raag Jadav wrote:
> > On Wed, Apr 09, 2025 at 09:46:33AM +0800, jiangfeng@kylinos.cn wrote:
> > > From: Feng Jiang <jiangfeng@kylinos.cn>
> > >
> > > When calling scnprintf() to append recovery method to event_string,
> > > the second argument should be `sizeof(event_string) - len`, otherwise
> > > there is a potential overflow problem.
> > >
> > > Fixes: b7cf9f4ac1b8 ("drm: Introduce device wedged event")
> > > Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
> >
> > Reviewed-by: Raag Jadav <raag.jadav@intel.com>
> >
> > Thanks for the fix.
>
> This one seems got lost in the noise but important for 6.15.
> Any takers?
pushed to drm-misc-fixes
>
> Raag
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-02 13:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09 1:46 [PATCH v3] drm: Fix potential overflow issue in event_string array jiangfeng
2025-04-09 4:03 ` André Almeida
2025-04-09 6:24 ` Raag Jadav
2025-05-01 12:22 ` Raag Jadav
2025-05-02 13:35 ` Rodrigo Vivi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox