Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Missing cleanup of drm_mode_config resources on dma_resv_alloc() 
failure path.
--

commit 80153f7004414d9b79ec627bceffaa8edbb89641
Author: Christian König <[email protected]>

drm/mode_config: Use dma_resv_alloc for lockdep annotation

This commit replaces the stack-allocated dma_resv in the lockdep
annotation code with a dynamically allocated one using dma_resv_alloc().
If the allocation fails, it returns -ENOMEM early.

> diff --git a/drivers/gpu/drm/drm_mode_config.c 
> b/drivers/gpu/drm/drm_mode_config.c
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -658,10 +658,12 @@ int drmm_mode_config_init(struct drm_device *dev)
>       if (IS_ENABLED(CONFIG_LOCKDEP)) {
>               struct drm_modeset_acquire_ctx modeset_ctx;
>               struct ww_acquire_ctx resv_ctx;
> -             struct dma_resv resv;
> +             struct dma_resv *resv;
>               int ret;
>  
> -             dma_resv_init(&resv);
> +             resv = dma_resv_alloc();
> +             if (!resv)
> +                     return -ENOMEM;

[Severity: Medium]
Does returning -ENOMEM here leak the drm_mode_config resources?

Since drmm_add_action_or_reset() hasn't been called yet to register the
managed cleanup action, should this failure path call
drm_mode_config_cleanup() before returning, similar to how it is handled
earlier in drmm_mode_config_init() when drm_mode_create_standard_properties()
fails?

[ ... ]

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=6

Reply via email to