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
This commit is contained in:
parent
7150314eae
commit
c11862c030
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user