aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2018-06-09 14:47:49 +0000
committerAndrew Turner <andrew@FreeBSD.org>2018-06-09 14:47:49 +0000
commitc11862c030e4aa13688d367521e3988d17c69941 (patch)
tree19fa0200c4cdcb5e486bdeb8c2d0bc331087d1ce /sys/dev
parent7150314eaefb50e8a91d3c60b044807a28dd9c41 (diff)
downloadsrc-c11862c030e4aa13688d367521e3988d17c69941.tar.gz
src-c11862c030e4aa13688d367521e3988d17c69941.zip
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
Notes
Notes: svn path=/head/; revision=334880
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/vnic/thunder_bgx_fdt.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/vnic/thunder_bgx_fdt.c b/sys/dev/vnic/thunder_bgx_fdt.c
index c3b0db465edd..86ca4d1a4f1f 100644
--- a/sys/dev/vnic/thunder_bgx_fdt.c
+++ b/sys/dev/vnic/thunder_bgx_fdt.c
@@ -93,44 +93,44 @@ bgx_fdt_phy_mode_match(struct bgx *bgx, char *qlm_mode, ssize_t size)
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, ssize_t size)
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);