svn commit: r258140 - head/sys/dev/oce

Xin LI delphij at FreeBSD.org
Thu Nov 14 18:53:18 UTC 2013


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");


More information about the svn-src-head mailing list