netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUERY] mctp: getsockopt unknown option return code -EINVAL
@ 2025-09-01  7:11 Alok Tiwari
  2025-09-01  7:24 ` Jeremy Kerr
  0 siblings, 1 reply; 4+ messages in thread
From: Alok Tiwari @ 2025-09-01  7:11 UTC (permalink / raw)
  To: jk, matt, davem, edumazet, kuba, pabeni, horms, netdev; +Cc: alok.a.tiwari

net/mctp/af_mctp.c
In mctp_getsockopt(), unknown options currently return -EINVAL.
In contrast, mctp_setsockopt() returns -ENOPROTOOPT for unknown
options.

Would it be ideal to return -ENOPROTOOPT instead of -EINVAL in
mctp_getsockopt() when an option is unrecognized?
This would match the behavior of mctp_setsockopt() and follow the
standard kernel socket API convention for unknown options.

---
 net/mctp/af_mctp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c
index df4e8cf33899b..e8938ca35a066 100644
--- a/net/mctp/af_mctp.c
+++ b/net/mctp/af_mctp.c
@@ -425,7 +425,7 @@ static int mctp_getsockopt(struct socket *sock, int level, int optname,
 		return 0;
 	}
 
-	return -EINVAL;
+	return -EINVAL; // > ENOPROTOOPT
 }
 
 /* helpers for reading/writing the tag ioc, handling compatibility across the
-- 
2.50.1


Thanks,
Alok

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-02  3:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01  7:11 [QUERY] mctp: getsockopt unknown option return code -EINVAL Alok Tiwari
2025-09-01  7:24 ` Jeremy Kerr
2025-09-01  9:59   ` ALOK TIWARI
2025-09-02  3:59     ` Jeremy Kerr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).