Re: [PATCH 1/2] net: tcp_header_len_th and tcp_option_len_th

From: Eric Dumazet
Date: Tue Jan 12 2010 - 05:40:41 EST


Le 06/01/2010 22:28, William Allen Simpson a écrit :
> Redefine two TCP header functions to accept TCP header pointer.
> When subtracting, return signed int to allow error checking.
>
> These functions will be used in subsequent patches that implement
> additional features.
>
> Signed-off-by: William.Allen.Simpson@xxxxxxxxx
> ---
> include/linux/tcp.h | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>

Its better to inline your patches so that we can comment them, without copy/paste

When I hit 'reply to', my mailer only quoted the ChangeLog, not the patch.

Anyway ..

+/* Length of standard options only. This could be negative. */
+static inline int tcp_option_len_th(const struct tcphdr *th)
+{
+ return (int)(th->doff * 4) - sizeof(*th);
+}


The (int) cast is not necessary, since the function returns a signed int

->
return th->doff * 4 - sizeof(*th);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/