Commit 509e7a31 authored by Marcelo Ricardo Leitner's avatar Marcelo Ricardo Leitner Committed by David S. Miller

sctp: sctp_chunk_length_valid should return bool

Signed-off-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 66b91d2c
...@@ -160,23 +160,22 @@ static sctp_disposition_t __sctp_sf_do_9_1_abort(struct net *net, ...@@ -160,23 +160,22 @@ static sctp_disposition_t __sctp_sf_do_9_1_abort(struct net *net,
/* Small helper function that checks if the chunk length /* Small helper function that checks if the chunk length
* is of the appropriate length. The 'required_length' argument * is of the appropriate length. The 'required_length' argument
* is set to be the size of a specific chunk we are testing. * is set to be the size of a specific chunk we are testing.
* Return Values: 1 = Valid length * Return Values: true = Valid length
* 0 = Invalid length * false = Invalid length
* *
*/ */
static inline int static inline bool
sctp_chunk_length_valid(struct sctp_chunk *chunk, sctp_chunk_length_valid(struct sctp_chunk *chunk, __u16 required_length)
__u16 required_length)
{ {
__u16 chunk_length = ntohs(chunk->chunk_hdr->length); __u16 chunk_length = ntohs(chunk->chunk_hdr->length);
/* Previously already marked? */ /* Previously already marked? */
if (unlikely(chunk->pdiscard)) if (unlikely(chunk->pdiscard))
return 0; return false;
if (unlikely(chunk_length < required_length)) if (unlikely(chunk_length < required_length))
return 0; return false;
return 1; return true;
} }
/********************************************************** /**********************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment