diff mbox series

[net-next] tipc: Return -EINVAL on error from addr2str() methods

Message ID 20241008142442.652219-1-syoshida@redhat.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tipc: Return -EINVAL on error from addr2str() methods | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 6 this patch: 6
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 2 this patch: 2
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-10--09-00 (tests: 775)

Commit Message

Shigeru Yoshida Oct. 8, 2024, 2:24 p.m. UTC
The return value 1 on error of the addr2str() methods are not
descriptive. Return -EINVAL instead.

Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
 net/tipc/eth_media.c | 2 +-
 net/tipc/ib_media.c  | 2 +-
 net/tipc/udp_media.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Paolo Abeni Oct. 10, 2024, 9:39 a.m. UTC | #1
On 10/8/24 16:24, Shigeru Yoshida wrote:
> The return value 1 on error of the addr2str() methods are not
> descriptive. Return -EINVAL instead.
> 
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>

I'm sorry if I gave conflicting advice in the past, but I now think this 
patch falls under the 'small cleanup patches' category we are actively 
discouraging outside the scope of a wider (functional) change:

https://lore.kernel.org/netdev/20241009-doc-mc-clean-v2-1-e637b665fa81@kernel.org/

Thanks,

Paolo
diff mbox series

Patch

diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index cb0d185e06af..fa33b333fb0d 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -42,7 +42,7 @@  static int tipc_eth_addr2str(struct tipc_media_addr *addr,
 			     char *strbuf, int bufsz)
 {
 	if (bufsz < 18)	/* 18 = strlen("aa:bb:cc:dd:ee:ff\0") */
-		return 1;
+		return -EINVAL;
 
 	sprintf(strbuf, "%pM", addr->value);
 	return 0;
diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c
index b9ad0434c3cd..8bda3aa78891 100644
--- a/net/tipc/ib_media.c
+++ b/net/tipc/ib_media.c
@@ -49,7 +49,7 @@  static int tipc_ib_addr2str(struct tipc_media_addr *a, char *str_buf,
 			    int str_size)
 {
 	if (str_size < 60)	/* 60 = 19 * strlen("xx:") + strlen("xx\0") */
-		return 1;
+		return -EINVAL;
 
 	sprintf(str_buf, "%20phC", a->value);
 
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 439f75539977..78fff7ad4b2f 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -137,7 +137,7 @@  static int tipc_udp_addr2str(struct tipc_media_addr *a, char *buf, int size)
 		snprintf(buf, size, "%pI6:%u", &ua->ipv6, ntohs(ua->port));
 	else {
 		pr_err("Invalid UDP media address\n");
-		return 1;
+		return -EINVAL;
 	}
 
 	return 0;