diff mbox series

[net] tipc: Remove redundant call to TLV_SPACE()

Message ID 20231114144336.1714364-1-syoshida@redhat.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] tipc: Remove redundant call to TLV_SPACE() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1134 this patch: 1134
netdev/cc_maintainers success CCed 7 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1161 this patch: 1161
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1161 this patch: 1161
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Shigeru Yoshida Nov. 14, 2023, 2:43 p.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.

Fixes: d0796d1ef63d ("tipc: convert legacy nl bearer dump to nl compat")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
 net/tipc/netlink_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Abeni Nov. 16, 2023, 9:46 a.m. UTC | #1
Hi,

On Tue, 2023-11-14 at 23:43 +0900, Shigeru Yoshida 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.
> 
> Fixes: d0796d1ef63d ("tipc: convert legacy nl bearer dump to nl compat")
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>

The patch LGTM, but I think this is more a cleanup then a fix, please
re-submit it for net-next, dropping the Fixes tag (so it will not land
in stable tree).

With the above you can add:

Acked-by: Paolo Abeni <pabeni@redhat.com>
> ---
>  net/tipc/netlink_compat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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);
>
Shigeru Yoshida Nov. 17, 2023, 12:26 a.m. UTC | #2
On Thu, 16 Nov 2023 10:46:30 +0100, Paolo Abeni wrote:
> Hi,
> 
> On Tue, 2023-11-14 at 23:43 +0900, Shigeru Yoshida 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.
>> 
>> Fixes: d0796d1ef63d ("tipc: convert legacy nl bearer dump to nl compat")
>> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> 
> The patch LGTM, but I think this is more a cleanup then a fix, please
> re-submit it for net-next, dropping the Fixes tag (so it will not land
> in stable tree).
> 
> With the above you can add:
> 
> Acked-by: Paolo Abeni <pabeni@redhat.com>

Hi Paolo,

Thanks for your feedback! I'll resubmit the patch for net-next.

Thanks
Shigeru

>> ---
>>  net/tipc/netlink_compat.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> 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);
>>  
>
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);