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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 8 Feb 2011 13:57:33 +0100
From:	Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:	Hans Verkuil <hverkuil@...all.nl>
Cc:	Sakari Ailus <sakari.ailus@...well.research.nokia.com>,
	linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
	alsa-devel@...a-project.org, broonie@...nsource.wolfsonmicro.com,
	clemens@...isch.de
Subject: Re: [PATCH v8 05/12] media: Entity use count

Hi Hans,

On Friday 04 February 2011 14:19:19 Hans Verkuil wrote:
> On Friday, February 04, 2011 13:34:02 Sakari Ailus wrote:
> > Hi,
> > 
> > And many thanks for the comments!
> > 
> > Hans Verkuil wrote:
> > ...
> > 
> > >> diff --git a/include/media/media-entity.h
> > >> b/include/media/media-entity.h index b82f824..114541a 100644
> > >> --- a/include/media/media-entity.h
> > >> +++ b/include/media/media-entity.h
> > >> @@ -81,6 +81,8 @@ struct media_entity {
> > >> 
> > >>  	struct media_pad *pads;		/* Pads array (num_pads elements) */
> > >>  	struct media_link *links;	/* Links array (max_links elements)*/
> > >> 
> > >> +	int use_count;			/* Use count for the entity. */
> > > 
> > > Isn't unsigned better?
> > 
> > Could be. The result, though, will be slightly more difficult checking
> > for bad use count --- which always is a driver bug.
> > 
> > me->use_count += change;
> > WARN_ON(me->use_count < 0);
> > 
> > we must do something like this:
> > 
> > if (change < 0)
> > 
> > 	WARN_ON(me->use_count < (unsigned)-change);
> > 
> > me->use_count += change;
> > 
> > I'd perhaps also go with unsigned int; the choice for signed was made
> > mainly since the above check and with signed int the check was more
> > trivial.
> 
> I saw this WARN_ON as well. I think there is a good reason for that
> WARN_ON, but I think a comment in the header explaining why it is an int
> will be useful. If I trip over it, then others will as well :-)

I'll add a comment. Thanks.

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ