diff options
author | Shan Wei <shanwei@cn.fujitsu.com> | 2011-04-19 17:27:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-20 04:51:02 -0400 |
commit | 48669698c23339e0fa31753f04e77648fc210339 (patch) | |
tree | d8480e12cc6aa6a1d0671f025b151eb14d32cb30 /include/net/sctp/sctp.h | |
parent | 96ca468b86b09aa6a001ac65dba93a6c4a3692a5 (diff) |
sctp: remove redundant check when walking through a list of TLV parameters
When pos.v <= (void *)chunk + end - ntohs(pos.p->length) and
ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t) these two expressions are all true,
pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) *must* be true.
This patch removes this kind of redundant check.
It's same to _sctp_walk_errors macro.
Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sctp/sctp.h')
-rw-r--r-- | include/net/sctp/sctp.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 505845ddb0be..7e8e34c29270 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -531,7 +531,6 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) | |||
531 | 531 | ||
532 | #define _sctp_walk_params(pos, chunk, end, member)\ | 532 | #define _sctp_walk_params(pos, chunk, end, member)\ |
533 | for (pos.v = chunk->member;\ | 533 | for (pos.v = chunk->member;\ |
534 | pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ | ||
535 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ | 534 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ |
536 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ | 535 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ |
537 | pos.v += WORD_ROUND(ntohs(pos.p->length))) | 536 | pos.v += WORD_ROUND(ntohs(pos.p->length))) |
@@ -542,7 +541,6 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | |||
542 | #define _sctp_walk_errors(err, chunk_hdr, end)\ | 541 | #define _sctp_walk_errors(err, chunk_hdr, end)\ |
543 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 542 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ |
544 | sizeof(sctp_chunkhdr_t));\ | 543 | sizeof(sctp_chunkhdr_t));\ |
545 | (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ | ||
546 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ | 544 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
547 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 545 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ |
548 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) | 546 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) |