From: Shigeru Yoshida <syoshida@redhat.com>
Date: Fri, 17 Nov 2023 00:37:04 +0000 (+0900)
Subject: tipc: Remove redundant call to TLV_SPACE()
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d580d265e9abb8c4e1e891051c7b03f3eac86055;p=linux.git

tipc: Remove redundant call to TLV_SPACE()

The purpose of TLV_SPACE() is to add the TLV descriptor size to the size of
the TLV value passed as argument and align the resulting size to
TLV_ALIGNTO.

tipc_tlv_alloc() calls TLV_SPACE() on its argument. In other words,
tipc_tlv_alloc() takes its argument as the size of the TLV value. So the
call to TLV_SPACE() in tipc_get_err_tlv() is redundant. Let's remove this
redundancy.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index c763008a8adba..079aebb16ed8f 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -168,7 +168,7 @@ static struct sk_buff *tipc_get_err_tlv(char *str)
 	int str_len = strlen(str) + 1;
 	struct sk_buff *buf;
 
-	buf = tipc_tlv_alloc(TLV_SPACE(str_len));
+	buf = tipc_tlv_alloc(str_len);
 	if (buf)
 		tipc_add_tlv(buf, TIPC_TLV_ERROR_STRING, str, str_len);