lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yy1271xW1SOlL41e@intel.com>
Date:   Fri, 23 Sep 2022 12:05:51 +0300
From:   Ville Syrjälä <ville.syrjala@...ux.intel.com>
To:     Javier Martinez Canillas <javierm@...hat.com>
Cc:     linux-kernel@...r.kernel.org,
        Thomas Zimmermann <tzimmermann@...e.de>,
        Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...ux.ie>,
        dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/ssd130x: Use drm_atomic_get_new_plane_state()

On Fri, Sep 23, 2022 at 10:34:47AM +0200, Javier Martinez Canillas wrote:
> The struct drm_plane .state shouldn't be accessed directly but instead the
> drm_atomic_get_new_plane_state() helper function should be used.
> 
> This is based on a similar patch from Thomas Zimmermann for the simpledrm
> driver. No functional changes.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@...ux.intel.com>
> Signed-off-by: Javier Martinez Canillas <javierm@...hat.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@...ux.intel.com>

I wonder how many naked obj->state dereferences are still
left in places where they should be using the get_{new,old}()
stuff. Might have to write a bit of cocci to find out...


Btw on a somewhat related note, I've been thinking about bringing
for_each_crtc_in_state() & co. back (got removed in commit
77ac3b00b131 ("drm/atomic: Remove deprecated accessor macros"))
but this time without any object state iterator variable. Now that
we're more often just plumbing the full atomic state through I
think there are bunch of places that don't need the object state(s)
within the loop at all, so having to have those variables around
makes the whole thing a bit noisy. Also IIRC we had to add some
(void) casts into the current macros to hide some compiler warnings
about unused variables. Could get rid of at least some of those extra
casts again.

I don't suppose there's anyone interested in doing that so I don't
have to? ;)

>---
> 
>  drivers/gpu/drm/solomon/ssd130x.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
> index 7fae9480aa11..a537692100d1 100644
> --- a/drivers/gpu/drm/solomon/ssd130x.c
> +++ b/drivers/gpu/drm/solomon/ssd130x.c
> @@ -566,10 +566,10 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb, const struct iosys_m
>  }
>  
>  static void ssd130x_primary_plane_helper_atomic_update(struct drm_plane *plane,
> -						       struct drm_atomic_state *old_state)
> +						       struct drm_atomic_state *state)
>  {
> -	struct drm_plane_state *plane_state = plane->state;
> -	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(old_state, plane);
> +	struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane);
> +	struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, plane);
>  	struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(plane_state);
>  	struct drm_device *drm = plane->dev;
>  	struct drm_rect src_clip, dst_clip;
> @@ -591,7 +591,7 @@ static void ssd130x_primary_plane_helper_atomic_update(struct drm_plane *plane,
>  }
>  
>  static void ssd130x_primary_plane_helper_atomic_disable(struct drm_plane *plane,
> -							struct drm_atomic_state *old_state)
> +							struct drm_atomic_state *state)
>  {
>  	struct drm_device *drm = plane->dev;
>  	struct ssd130x_device *ssd130x = drm_to_ssd130x(drm);
> -- 
> 2.37.3

-- 
Ville Syrjälä
Intel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ