All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Kaiser <nikai@nikai.net>
To: Shan Wei <shanwei@cn.fujitsu.com>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>,
	Sridhar Samudrala <sri@us.ibm.com>,
	linux-sctp@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sctp: remove redundant chunk length check
Date: Thu, 21 Oct 2010 13:08:47 +0000	[thread overview]
Message-ID: <20101021150847.3a5f3cb7@absol.kitzblitz> (raw)
In-Reply-To: <4CC02CDF.5040700@cn.fujitsu.com>

* Shan Wei <shanwei@cn.fujitsu.com>:
> Nicolas Kaiser wrote, at 10/21/2010 06:14 PM:
> > Checking the chunk length at this point appears redundant, as
> > the rest of the packet gets discarded anyway.
 
> Yes, indeed.
> 
> How did you find this? By reviewing the source code?

Actually I'm tinkering with Coccinelle patches.

Here's a simple semantic patch, that will give a lot of false
positives, and a lot of "if (a) return b; return b;":

// <smpl>
@@
expression a;
statement S;
@@

- if (a)
- {
- S
- }
 S
// </smpl>

Best regards,
Nicolas Kaiser

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Kaiser <nikai@nikai.net>
To: Shan Wei <shanwei@cn.fujitsu.com>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>,
	Sridhar Samudrala <sri@us.ibm.com>,
	linux-sctp@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sctp: remove redundant chunk length check
Date: Thu, 21 Oct 2010 15:08:47 +0200	[thread overview]
Message-ID: <20101021150847.3a5f3cb7@absol.kitzblitz> (raw)
In-Reply-To: <4CC02CDF.5040700@cn.fujitsu.com>

* Shan Wei <shanwei@cn.fujitsu.com>:
> Nicolas Kaiser wrote, at 10/21/2010 06:14 PM:
> > Checking the chunk length at this point appears redundant, as
> > the rest of the packet gets discarded anyway.
 
> Yes, indeed.
> 
> How did you find this? By reviewing the source code?

Actually I'm tinkering with Coccinelle patches.

Here's a simple semantic patch, that will give a lot of false
positives, and a lot of "if (a) return b; return b;":

// <smpl>
@@
expression a;
statement S;
@@

- if (a)
- {
- S
- }
 S
// </smpl>

Best regards,
Nicolas Kaiser

  reply	other threads:[~2010-10-21 13:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 10:14 [PATCH] sctp: remove redundant chunk length check Nicolas Kaiser
2010-10-21 10:14 ` Nicolas Kaiser
2010-10-21 12:06 ` Shan Wei
2010-10-21 12:06   ` Shan Wei
2010-10-21 13:08   ` Nicolas Kaiser [this message]
2010-10-21 13:08     ` Nicolas Kaiser

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=20101021150847.3a5f3cb7@absol.kitzblitz \
    --to=nikai@nikai.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=shanwei@cn.fujitsu.com \
    --cc=sri@us.ibm.com \
    --cc=vladislav.yasevich@hp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.