Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jun 2018 14:47:49 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334880 - head/sys/dev/vnic
Message-ID:  <201806091447.w59ElnpU026396@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sat Jun  9 14:47:49 2018
New Revision: 334880
URL: https://svnweb.freebsd.org/changeset/base/334880

Log:
  In the ThunderX BGX network driver we were skipping the NULL terminator
  when parsing the phy type, however this is included in the length returned
  by OF_getprop. To fix this stop ignoring the terminator.
  
  PR:		228828
  Reported by:	sbruno
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/vnic/thunder_bgx_fdt.c

Modified: head/sys/dev/vnic/thunder_bgx_fdt.c
==============================================================================
--- head/sys/dev/vnic/thunder_bgx_fdt.c	Sat Jun  9 14:26:30 2018	(r334879)
+++ head/sys/dev/vnic/thunder_bgx_fdt.c	Sat Jun  9 14:47:49 2018	(r334880)
@@ -93,44 +93,44 @@ bgx_fdt_phy_mode_match(struct bgx *bgx, char *qlm_mode
 	switch (bgx->qlm_mode) {
 	case QLM_MODE_SGMII:
 		type = "sgmii";
-		sz = sizeof("sgmii") - 1;
+		sz = sizeof("sgmii");
 		offset = size - sz;
 		break;
 	case QLM_MODE_XAUI_1X4:
 		type = "xaui";
-		sz = sizeof("xaui") - 1;
+		sz = sizeof("xaui");
 		offset = size - sz;
 		if (offset < 0)
 			return (FALSE);
 		if (strncmp(&qlm_mode[offset], type, sz) == 0)
 			return (TRUE);
 		type = "dxaui";
-		sz = sizeof("dxaui") - 1;
+		sz = sizeof("dxaui");
 		offset = size - sz;
 		break;
 	case QLM_MODE_RXAUI_2X2:
 		type = "raui";
-		sz = sizeof("raui") - 1;
+		sz = sizeof("raui");
 		offset = size - sz;
 		break;
 	case QLM_MODE_XFI_4X1:
 		type = "xfi";
-		sz = sizeof("xfi") - 1;
+		sz = sizeof("xfi");
 		offset = size - sz;
 		break;
 	case QLM_MODE_XLAUI_1X4:
 		type = "xlaui";
-		sz = sizeof("xlaui") - 1;
+		sz = sizeof("xlaui");
 		offset = size - sz;
 		break;
 	case QLM_MODE_10G_KR_4X1:
 		type = "xfi-10g-kr";
-		sz = sizeof("xfi-10g-kr") - 1;
+		sz = sizeof("xfi-10g-kr");
 		offset = size - sz;
 		break;
 	case QLM_MODE_40G_KR4_1X4:
 		type = "xlaui-40g-kr";
-		sz = sizeof("xlaui-40g-kr") - 1;
+		sz = sizeof("xlaui-40g-kr");
 		offset = size - sz;
 		break;
 	default:
@@ -155,37 +155,37 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name
 	switch (bgx->qlm_mode) {
 	case QLM_MODE_SGMII:
 		type = "sgmii";
-		sz = sizeof("sgmii") - 1;
+		sz = sizeof("sgmii");
 		break;
 	case QLM_MODE_XAUI_1X4:
 		type = "xaui";
-		sz = sizeof("xaui") - 1;
+		sz = sizeof("xaui");
 		if (sz < size)
 			return (FALSE);
 		if (strncmp(phy_name, type, sz) == 0)
 			return (TRUE);
 		type = "dxaui";
-		sz = sizeof("dxaui") - 1;
+		sz = sizeof("dxaui");
 		break;
 	case QLM_MODE_RXAUI_2X2:
 		type = "raui";
-		sz = sizeof("raui") - 1;
+		sz = sizeof("raui");
 		break;
 	case QLM_MODE_XFI_4X1:
 		type = "xfi";
-		sz = sizeof("xfi") - 1;
+		sz = sizeof("xfi");
 		break;
 	case QLM_MODE_XLAUI_1X4:
 		type = "xlaui";
-		sz = sizeof("xlaui") - 1;
+		sz = sizeof("xlaui");
 		break;
 	case QLM_MODE_10G_KR_4X1:
 		type = "xfi-10g-kr";
-		sz = sizeof("xfi-10g-kr") - 1;
+		sz = sizeof("xfi-10g-kr");
 		break;
 	case QLM_MODE_40G_KR4_1X4:
 		type = "xlaui-40g-kr";
-		sz = sizeof("xlaui-40g-kr") - 1;
+		sz = sizeof("xlaui-40g-kr");
 		break;
 	default:
 		return (FALSE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806091447.w59ElnpU026396>