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: <Y7P+zZEF09YWs5yW@qemulion>
Date:   Tue, 3 Jan 2023 15:39:17 +0530
From:   Deepak R Varma <drv@...lo.com>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     "Maciej W. Rozycki" <macro@...am.me.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Saurabh Singh Sengar <ssengar@...rosoft.com>,
        Praveen Kumar <kumarpraveen@...ux.microsoft.com>,
        Deepak R Varma <drv@...lo.com>
Subject: Re: [PATCH v4 2/2] tty: serial: dz: convert atomic_* to refcount_*
 APIs for irq_guard

On Tue, Jan 03, 2023 at 10:00:48AM +0100, Jiri Slaby wrote:
> On 26. 12. 22, 7:21, Deepak R Varma wrote:
> > The refcount_* APIs are designed to address known issues with the
> > atomic_t APIs for reference counting. They provide following distinct
> > advantages:
> >     - protect the reference counters from overflow/underflow
> >     - avoid use-after-free errors
> >     - provide improved memory ordering guarantee schemes
> >     - neater and safer.
> > Hence, replace the atomic_* APIs by their equivalent refcount_t
> > API functions.
> >
> > This patch proposal address the following warnings generated by
> > the atomic_as_refcounter.cocci coccinelle script
> > atomic_add_return(-1, ...)
> ...
> > --- a/drivers/tty/serial/dz.c
> > +++ b/drivers/tty/serial/dz.c
> ...
> > @@ -400,18 +399,16 @@ static int dz_startup(struct uart_port *uport)
> >   	struct dz_port *dport = to_dport(uport);
> >   	struct dz_mux *mux = dport->mux;
> >   	unsigned long flags;
> > -	int irq_guard;
> >   	int ret;
> >   	u16 tmp;
> >
> > -	irq_guard = atomic_add_return(1, &mux->irq_guard);
> > -	if (irq_guard != 1)
> > +	refcount_inc(&mux->irq_guard);
> > +	if (refcount_read(&mux->irq_guard) != 1)
> >   		return 0;
> >
> > -	ret = request_irq(dport->port.irq, dz_interrupt,
> > -			  IRQF_SHARED, "dz", mux);
> > +	ret = request_irq(dport->port.irq, dz_interrupt, IRQF_SHARED, "dz", mux);
>
> How is this related to the above described change?

No, it is not. My apologies. I must have joined the lines for improved readability
and forgot to revert. I will restore this in next revision based on the feedback
on the other patch of this series. OR I can include this change in the current
change log as a "while at it..." statement. Would you advise me?

Thank you,
./drv

>
> --
> js
> suse labs
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ