From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Deepak R Varma <drv@mailo.com>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: Re: [PATCH] tty: serial: convert atomic_* to refcount_* APIs
Date: Thu, 22 Dec 2022 06:55:01 +0100 [thread overview]
Message-ID: <Y6PxNRgzPAdukDs5@kroah.com> (raw)
In-Reply-To: <Y6NlNB9c22XiYHdD@qemulion>
On Thu, Dec 22, 2022 at 01:27:40AM +0530, Deepak R Varma wrote:
> The refcount_* APIs are designed to address known issues with the
> atomic_t APIs for reference counting. They protect the reference
> counters from overflow/underflow, use-after-free errors, provide
> improved memory ordering guarantee schemes, are 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, ...)
>
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> Note: The patch is compile tested using dec_station.defconfig for
> MIPS architecture.
Do you have this hardware? If not, please just do
one-variable-at-a-time so that if there are real problems, we can revert
the offending change easier. And it makes it simpler to review.
But, are you sure this is correct:
> - 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)
That is now different logic than before, why? Are you sure this is ok?
I stopped reviewing here...
thanks,
greg k-h
next prev parent reply other threads:[~2022-12-22 5:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 19:57 [PATCH] tty: serial: convert atomic_* to refcount_* APIs Deepak R Varma
2022-12-22 5:55 ` Greg Kroah-Hartman [this message]
2022-12-22 14:02 ` Deepak R Varma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y6PxNRgzPAdukDs5@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=drv@mailo.com \
--cc=jirislaby@kernel.org \
--cc=kumarpraveen@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=ssengar@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox