batman-adv: reuse tt_len() to calculate tt buffer length

Message ID 1311957165-16335-1-git-send-email-lindner_marek@yahoo.de (mailing list archive)
State Accepted, archived
Commit bcfed173611707146dcb153f0d29b6d3e4aba6f1
Headers

Commit Message

Marek Lindner July 29, 2011, 4:32 p.m. UTC
  Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 aggregation.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
  

Comments

Antonio Quartulli July 29, 2011, 5:05 p.m. UTC | #1
On Fri, Jul 29, 2011 at 06:32:45 +0200, Marek Lindner wrote:
> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>

Acked-by: Antonio Quartulli <ordex@autistici.org>
  
Marek Lindner July 30, 2011, 8:48 a.m. UTC | #2
On Friday, July 29, 2011 19:05:24 Antonio Quartulli wrote:
> On Fri, Jul 29, 2011 at 06:32:45 +0200, Marek Lindner wrote:
> > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> 
> Acked-by: Antonio Quartulli <ordex@autistici.org>

Applied in revision bcfed17.

Regards,
Marek
  

Patch

diff --git a/aggregation.h b/aggregation.h
index 216337b..df4a5a9 100644
--- a/aggregation.h
+++ b/aggregation.h
@@ -28,8 +28,7 @@ 
 static inline int aggregated_packet(int buff_pos, int packet_len,
 				    int tt_num_changes)
 {
-	int next_buff_pos = buff_pos + BAT_PACKET_LEN + (tt_num_changes *
-						sizeof(struct tt_change));
+	int next_buff_pos = buff_pos + BAT_PACKET_LEN + tt_len(tt_num_changes);
 
 	return (next_buff_pos <= packet_len) &&
 		(next_buff_pos <= MAX_AGGREGATION_BYTES);