Date: Wed, 5 Dec 2018 13:20:51 +0000 (UTC) From: Slava Shwartsman <slavash@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341526 - head/sys/ofed/drivers/infiniband/core Message-ID: <201812051320.wB5DKpBP065518@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: slavash Date: Wed Dec 5 13:20:51 2018 New Revision: 341526 URL: https://svnweb.freebsd.org/changeset/base/341526 Log: 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 Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_mad.c Modified: head/sys/ofed/drivers/infiniband/core/ib_mad.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 5 13:20:22 2018 (r341525) +++ head/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 5 13:20:51 2018 (r341526) @@ -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?201812051320.wB5DKpBP065518>