svn commit: r341866 - stable/11/sys/ofed/drivers/infiniband/core

Hans Petter Selasky hselasky at FreeBSD.org
Wed Dec 12 10:29:49 UTC 2018


Author: hselasky
Date: Wed Dec 12 10:29:48 2018
New Revision: 341866
URL: https://svnweb.freebsd.org/changeset/base/341866

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/11/sys/ofed/drivers/infiniband/core/ib_mad.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c
==============================================================================
--- stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c	Wed Dec 12 10:28:50 2018	(r341865)
+++ stable/11/sys/ofed/drivers/infiniband/core/ib_mad.c	Wed Dec 12 10:29:48 2018	(r341866)
@@ -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)];


More information about the svn-src-all mailing list