DCCP protocol discussions
 help / color / mirror / Atom feed
From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 7/10]: Avoid `division by zero' errors
Date: Mon, 27 Nov 2006 10:24:14 +0000	[thread overview]
Message-ID: <200611271024.14815@strip-the-willow> (raw)
In-Reply-To: <200611241619.56426@strip-the-willow>

Quoting Ian McDonald:
|  On 11/25/06, Gerrit Renker <gerrit@erg.abdn.ac.uk> wrote:
|  > [CCID 3]: Avoid `division by zero' errors
|  >
|  > Several places of the code divide by the current RTT value. A division-by-zero
|  > error results if this value is 0.
|  > To protect against this,
|  >    * DCCP_BUG_ON conditions are added throughout the tx code;
|  
|  I can't remember what the definition of DCCP_BUG_ON was in the end.
|  
|  If it does follow the BUG path then I would like this changed to
|  DCCP_WARN... so that we don't kill the machine.

DCCP_BUG_ON is exactly for this purpose since we discussed it earlier:

#define DCCP_BUG(a...)       do { DCCP_CRIT("BUG: " a); dump_stack(); } while(0)
#define DCCP_BUG_ON(cond)    do { if (unlikely((cond) != 0))               \
                                     DCCP_BUG("\"%s\" holds (exception!)", \
                                              __stringify(cond));          \
                             } while (0)

The most important thing is that in places where DCCP_BUG(_ON) is called, it means
that something _internal_ is going wrong; and this should be fixed. Once it is fixed,
and we are sure it is unlikely to occur, we can simply replace

	DCCP_BUG()      with    BUG()     and
	DCCP_BUG_ON()   with    BUG_ON()

DCCP_WARN() on the other side is used for _external_ conditions (outside our control)]
going wrong, hence it is rate-limited, as suggested by Arnaldo.

  parent reply	other threads:[~2006-11-27 10:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-24 16:19 [PATCH 7/10]: Avoid `division by zero' errors Gerrit Renker
2006-11-26 20:59 ` Ian McDonald
2006-11-27 10:24 ` Gerrit Renker [this message]
2006-11-27 16:16 ` Eddie Kohler
2006-11-27 17:15 ` Gerrit Renker

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=200611271024.14815@strip-the-willow \
    --to=gerrit@erg.abdn.ac.uk \
    --cc=dccp@vger.kernel.org \
    /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