From owner-svn-src-head@freebsd.org Sat Jun 9 17:16:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC7201011A72; Sat, 9 Jun 2018 17:16:25 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 325AA684FA; Sat, 9 Jun 2018 14:47:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E82BA1F3E7; Sat, 9 Jun 2018 14:47:49 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w59ElnfH026397; Sat, 9 Jun 2018 14:47:49 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w59ElnpU026396; Sat, 9 Jun 2018 14:47:49 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201806091447.w59ElnpU026396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 9 Jun 2018 14:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334880 - head/sys/dev/vnic X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/vnic X-SVN-Commit-Revision: 334880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2018 17:16:25 -0000 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);