linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: roel kluin <roel.kluin@gmail.com>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org
Subject: Re: powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative
Date: Sun, 30 Nov 2008 10:20:14 +1100	[thread overview]
Message-ID: <18737.52782.650416.444270@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <4931201D.7060701@gmail.com>

roel kluin writes:

> unsigned hp->count and hvcsd->open_count cannot be negative
...
> -	if (--hvcsd->open_count == 0) {
> +	if (hvcsd->open_count == 1) {
> +		hvcsd->open_count--;

Why are we no longer decrementing hvcsd->open_count in the cases where
it is greater than 1?

> -	if (--hp->count == 0) {
> +	if (hp->count == 1) {
> +		hp->count--;

Ditto with hp->count here?

Also, I don't see why those changes have anything to do with "unsigned
things cannot be negative".  As long as those counts are never zero on
entry to those code sections, the existing code is fine, and I believe
that assertion can be maintained.  If you believe the code needs to
defend against the possibility of a zero count on entry, that should
have been explicitly stated in the patch description.

Paul.

  parent reply	other threads:[~2008-11-29 23:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-29 10:57 powerpc: hv{cs, si}_close() both unsigned hp->count and hvcsd->open_count cannot be negative roel kluin
2008-11-29 12:54 ` Andreas Schwab
2008-11-29 13:27   ` roel kluin
2008-11-29 15:01     ` Andreas Schwab
2008-11-29 23:20 ` Paul Mackerras [this message]
2008-11-30 11:16   ` Alan Cox
2008-11-30 21:23     ` Paul Mackerras

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=18737.52782.650416.444270@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=roel.kluin@gmail.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;
as well as URLs for NNTP newsgroup(s).