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] [day] [month] [year] [list]
Date:	Wed, 13 Jul 2016 13:07:14 -0300
From:	Mauro Carvalho Chehab <mchehab@...pensource.com>
To:	Davidlohr Bueso <dave@...olabs.net>
Cc:	peterz@...radead.org, mingo@...nel.org, davem@...emloft.net,
	cw00.choi@...sung.com, dougthompson@...ssion.com, bp@...en8.de,
	gregkh@...uxfoundation.org, pfg@....com, jikos@...nel.org,
	hans.verkuil@...co.com, awalls@...metrocast.net,
	dledford@...hat.com, sean.hefty@...el.com, kys@...rosoft.com,
	heiko.carstens@...ibm.com, James.Bottomley@...senPartnership.com,
	sumit.semwal@...aro.org, schwidefsky@...ibm.com,
	linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
	Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 07/12] drivers/media: Employ atomic_fetch_inc()

Em Mon, 20 Jun 2016 13:05:59 -0700
Davidlohr Bueso <dave@...olabs.net> escreveu:

> Now that we have fetch_inc() we can stop using inc_return() - 1.
> 
> These are very similar to the existing OP-RETURN primitives we already
> have, except they return the value of the atomic variable _before_
> modification.
> 
> Cc: Hans Verkuil <hans.verkuil@...co.com>
> Cc: Andy Walls <awalls@...metrocast.net>
> Cc: linux-media@...r.kernel.org
> Signed-off-by: Davidlohr Bueso <dbueso@...e.de>

I suspect that you'll be applying this together with the other patches
in this series. So:

Acked-by: Mauro Carvalho Chehab <mchehab@...pensource.com>

> ---
>  drivers/media/pci/cobalt/cobalt-driver.c | 2 +-
>  drivers/media/pci/cx18/cx18-driver.c     | 2 +-
>  drivers/media/v4l2-core/v4l2-device.c    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c
> index 8d6f04fc8013..70dfcb0c6a72 100644
> --- a/drivers/media/pci/cobalt/cobalt-driver.c
> +++ b/drivers/media/pci/cobalt/cobalt-driver.c
> @@ -683,7 +683,7 @@ static int cobalt_probe(struct pci_dev *pci_dev,
>  	int i;
>  
>  	/* FIXME - module parameter arrays constrain max instances */
> -	i = atomic_inc_return(&cobalt_instance) - 1;
> +	i = atomic_fetch_inc(&cobalt_instance);
>  
>  	cobalt = kzalloc(sizeof(struct cobalt), GFP_ATOMIC);
>  	if (cobalt == NULL)
> diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
> index 260e462d91b4..5cb3408c6859 100644
> --- a/drivers/media/pci/cx18/cx18-driver.c
> +++ b/drivers/media/pci/cx18/cx18-driver.c
> @@ -908,7 +908,7 @@ static int cx18_probe(struct pci_dev *pci_dev,
>  	struct cx18 *cx;
>  
>  	/* FIXME - module parameter arrays constrain max instances */
> -	i = atomic_inc_return(&cx18_instance) - 1;
> +	i = atomic_fetch_inc(&cx18_instance);
>  	if (i >= CX18_MAX_CARDS) {
>  		printk(KERN_ERR "cx18: cannot manage card %d, driver has a "
>  		       "limit of 0 - %d\n", i, CX18_MAX_CARDS - 1);
> diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
> index 06fa5f1b2cff..1bc5b68c2724 100644
> --- a/drivers/media/v4l2-core/v4l2-device.c
> +++ b/drivers/media/v4l2-core/v4l2-device.c
> @@ -76,7 +76,7 @@ EXPORT_SYMBOL_GPL(v4l2_device_put);
>  int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
>  						atomic_t *instance)
>  {
> -	int num = atomic_inc_return(instance) - 1;
> +	int num = atomic_fetch_inc(instance);
>  	int len = strlen(basename);
>  
>  	if (basename[len - 1] >= '0' && basename[len - 1] <= '9')



Thanks,
Mauro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ