Date: Wed, 12 Dec 2018 10:28:50 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341865 - stable/12/sys/ofed/drivers/infiniband/core Message-ID: <201812121028.wBCASocE013783@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Dec 12 10:28:50 2018 New Revision: 341865 URL: https://svnweb.freebsd.org/changeset/base/341865 Log: MFC r341526: ibcore: Fix an array index check The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS (80) elements. Hence compare the array index with that value instead of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity reports the following: Overrunning array class->method_table of 80 8-byte elements at element index 127 (byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class) (which evaluates to 127). Linux commit: 2fe2f378dd45847d2643638c07a7658822087836 Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_mad.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_mad.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 12 10:26:49 2018 (r341864) +++ stable/12/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 12 10:28:50 2018 (r341865) @@ -1753,7 +1753,7 @@ find_mad_agent(struct ib_mad_port_private *port_priv, if (!class) goto out; if (convert_mgmt_class(mad_hdr->mgmt_class) >= - IB_MGMT_MAX_METHODS) + ARRAY_SIZE(class->method_table)) goto out; method = class->method_table[convert_mgmt_class( mad_hdr->mgmt_class)];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812121028.wBCASocE013783>