Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 2013 18:53:18 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r258140 - head/sys/dev/oce
Message-ID:  <201311141853.rAEIrI6h044139@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Nov 14 18:53:17 2013
New Revision: 258140
URL: http://svnweb.freebsd.org/changeset/base/258140

Log:
  The previous code makes a memory allocation in size of
  struct mbx_common_read_write_flashrom plus 32KB and caps the actual
  transfer size at 32KB.  This is harmless as it is but may confuse
  static code analyzer, so allocate a full 32KB instead.
  
  Reported by:	Coverity via mjacob
  Submitted by:	Venkata Duvvuru <VenkatKumar.Duvvuru Emulex Com>
  Coverity CID:	1125820

Modified:
  head/sys/dev/oce/oce_hw.h
  head/sys/dev/oce/oce_sysctl.c

Modified: head/sys/dev/oce/oce_hw.h
==============================================================================
--- head/sys/dev/oce/oce_hw.h	Thu Nov 14 18:41:58 2013	(r258139)
+++ head/sys/dev/oce/oce_hw.h	Thu Nov 14 18:53:17 2013	(r258140)
@@ -1577,7 +1577,8 @@ struct mbx_common_read_write_flashrom {
 	uint32_t flash_op_type;
 	uint32_t data_buffer_size;
 	uint32_t data_offset;
-	uint8_t  data_buffer[4];	/* + IMAGE_TRANSFER_SIZE */
+	uint8_t  data_buffer[32768];	/* + IMAGE_TRANSFER_SIZE */
+	uint8_t  rsvd[4];
 };
 
 struct oce_phy_info {

Modified: head/sys/dev/oce/oce_sysctl.c
==============================================================================
--- head/sys/dev/oce/oce_sysctl.c	Thu Nov 14 18:41:58 2013	(r258139)
+++ head/sys/dev/oce/oce_sysctl.c	Thu Nov 14 18:53:17 2013	(r258140)
@@ -381,8 +381,8 @@ oce_sh_be3_flashdata(POCE_SOFTC sc, cons
 		return EINVAL;
 	}
 
-	rc = oce_dma_alloc(sc, sizeof(struct mbx_common_read_write_flashrom)
-			+ 32*1024, &dma_mem, 0);
+	rc = oce_dma_alloc(sc, sizeof(struct mbx_common_read_write_flashrom),
+				&dma_mem, 0);
 	if (rc) {
 		device_printf(sc->dev,
 				"Memory allocation failure while flashing\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311141853.rAEIrI6h044139>