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
This commit is contained in:
Xin LI 2013-11-14 18:53:17 +00:00
parent b770668b1e
commit d8f7bfb8bd
2 changed files with 4 additions and 3 deletions

View File

@ -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 {

View File

@ -381,8 +381,8 @@ oce_sh_be3_flashdata(POCE_SOFTC sc, const struct firmware *fw, int32_t num_imgs)
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");