diff mbox series

[net-next,v2] tipc: Remove redundant call to TLV_SPACE()

Message ID 20231117003704.1738094-1-syoshida@redhat.com (mailing list archive)
State Accepted
Commit d580d265e9abb8c4e1e891051c7b03f3eac86055
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] tipc: Remove redundant call to TLV_SPACE() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply success Patch already applied to net-next

Commit Message

Shigeru Yoshida Nov. 17, 2023, 12:37 a.m. UTC
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>
---
v1->v2:
- Re-submit to net-next
https://lore.kernel.org/all/20231114144336.1714364-1-syoshida@redhat.com/
---
 net/tipc/netlink_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 17, 2023, 2:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 17 Nov 2023 09:37:04 +0900 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] tipc: Remove redundant call to TLV_SPACE()
    https://git.kernel.org/netdev/net-next/c/d580d265e9ab

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 5bc076f2fa74..db0365c9b8bd 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -167,7 +167,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);