Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: mkubecek@suse.cz, danieller@nvidia.com, Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH ethtool 5/8] module-common: Avoid undefined behavior with CMIS transceivers
Date: Thu, 16 Jul 2026 09:45:29 +0300	[thread overview]
Message-ID: <20260716064532.1522382-6-idosch@nvidia.com> (raw)
In-Reply-To: <20260716064532.1522382-1-idosch@nvidia.com>

While the function that handles the printing of the transmitter
technology handles all the values passed by the SFF-8636 parser (0-15),
it does not handle all the values that can be passed by the CMIS parser
where this field is 8-bits.

Fix by adding a default case that will initialize "description" to
"Reserved or unknown".

Fixes: 88ca347ef35a ("Add QSFP-DD support")
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 module-common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/module-common.c b/module-common.c
index 997dd2b37ce7..ea4514ab3899 100644
--- a/module-common.c
+++ b/module-common.c
@@ -628,6 +628,9 @@ void module_show_mit_compliance(u16 value)
 		snprintf(description, SFF_MAX_DESC_LEN, "%s linear active equalizers",
 			 cc);
 		break;
+	default:
+		strncpy(description, "Reserved or unknown", SFF_MAX_DESC_LEN);
+		break;
 	}
 
 	sff_print_any_hex_field("Transmitter technology",
-- 
2.55.0


  parent reply	other threads:[~2026-07-16  6:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  6:45 [PATCH ethtool 0/8] cmis: Miscellaneous fixes Ido Schimmel
2026-07-16  6:45 ` [PATCH ethtool 1/8] cmis: Fix printing of Tx bias current Ido Schimmel
2026-07-16  6:45 ` [PATCH ethtool 2/8] cmis: Fix printing of channel-level flags Ido Schimmel
2026-07-16  6:45 ` [PATCH ethtool 3/8] cmis: Fix printing of CDB EPL pages Ido Schimmel
2026-07-16  6:45 ` [PATCH ethtool 4/8] module-common: Fix printing of transmitter technology for CMIS transceivers Ido Schimmel
2026-07-16  6:45 ` Ido Schimmel [this message]
2026-07-16  6:45 ` [PATCH ethtool 6/8] module-common: Add missing CMIS transmitter technologies Ido Schimmel
2026-07-16  6:45 ` [PATCH ethtool 7/8] cmis: Fix printing of attenuation and wavelength Ido Schimmel
2026-07-16  6:45 ` [PATCH ethtool 8/8] cmis: Fix printing of link length Ido Schimmel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260716064532.1522382-6-idosch@nvidia.com \
    --to=idosch@nvidia.com \
    --cc=danieller@nvidia.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox