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: <20241107093157.64750c19@booty>
Date: Thu, 7 Nov 2024 09:31:57 +0100
From: Luca Ceresoli <luca.ceresoli@...tlin.com>
To: Jani Nikula <jani.nikula@...ux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
 <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, David Airlie
 <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Thomas Petazzoni
 <thomas.petazzoni@...tlin.com>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/4] drm/mode_object: add
 drm_mode_object_read_refcount()

Hello Jani,

On Wed, 06 Nov 2024 14:03:08 +0200
Jani Nikula <jani.nikula@...ux.intel.com> wrote:

> On Wed, 06 Nov 2024, Luca Ceresoli <luca.ceresoli@...tlin.com> wrote:
> > Add a wrapper to kref_read() just like the ones already in place for
> > kref_get() and kref_put(). This will be used for sanity checks on object
> > lifetime.
> >
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@...tlin.com>
> > ---
> >  drivers/gpu/drm/drm_mode_object.c | 20 ++++++++++++++++++++
> >  include/drm/drm_mode_object.h     |  1 +
> >  2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> > index df4cc0e8e263d5887a799cf1a61d998234be7158..f990cc7e9b5d3bda3453123593314fa1ea2bf923 100644
> > --- a/drivers/gpu/drm/drm_mode_object.c
> > +++ b/drivers/gpu/drm/drm_mode_object.c
> > @@ -217,6 +217,26 @@ void drm_mode_object_get(struct drm_mode_object *obj)
> >  }
> >  EXPORT_SYMBOL(drm_mode_object_get);
> >  
> > +/**
> > + * drm_mode_object_get - read the refcount for a mode object
> > + * @obj: DRM mode object
> > + *
> > + * This function returns the current object's refcount if it is a
> > + * refcounted modeset object, or 0 on any other object.  
> 
> Returns: The current object's ...
> 
> > + */
> > +unsigned int drm_mode_object_read_refcount(struct drm_mode_object *obj)
> > +{
> > +	unsigned int refcount = 0;
> > +
> > +	if (obj->free_cb) {
> > +		refcount = kref_read(&obj->refcount);
> > +		DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, refcount);  
> 
> Please ditch the debug.

OK, will do both in v3.

Luca
-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ