All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity
@ 2016-03-16 13:45 Simon Glass
  2016-03-16 13:45 ` [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data Simon Glass
                   ` (13 more replies)
  0 siblings, 14 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

A lot of issues have been found in the error handling with recent additions
to the FIT handling code in mkimage. In some cases buffers are not freed or
files are not closed. Fix these problems and a few others in existing code
that coverity noticed due to recent patches.


Simon Glass (14):
  mkimage: Fix munmap() call when importing data
  mkimage: Correct file being closed twice in fit_import_data()
  mkimage: Correct file being closed twice in fit_extract_data()
  part_iso: Drop the customer unaligned access functions
  part_efi: Drop the NULL check on dev_desc in part_print_efi()
  part_efi: Drop NULL check in part_get_info_efi()
  mkimage: Close the file when unable to get its size
  mkimage: Add a missing free() to fit_import_data()
  mkimage: Fix error path in fit_extract_data()
  mkimage: Fix missing free() in fit_extract_data()
  mkimage: Fix missing free() and close() in fit_build()
  mkimage: Ensure file is closed in fdt_property_file()
  mkimage: Don't close the file if it wasn't opened
  usb: Correct return value in usb_stor_info()

 common/usb_storage.c |  2 +-
 disk/part_efi.c      |  6 +-----
 disk/part_iso.c      | 27 ++++-----------------------
 tools/fit_image.c    | 28 ++++++++++++++++++----------
 tools/imagetool.c    |  1 +
 5 files changed, 25 insertions(+), 39 deletions(-)

-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data() Simon Glass
                   ` (12 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The munmap() call unmaps the wrong memory buffer. Fix it.

Reported-by: Coverity (CID: 138505)
Reported-by: Coverity (CID: 138495)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 3ecc88f..2c8d92f 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -517,7 +517,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
 		}
 	}
 
-	munmap(fdt, sbuf.st_size);
+	munmap(old_fdt, sbuf.st_size);
 	close(fd);
 
 	/* Pack the FDT and place the data after it */
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
  2016-03-16 13:45 ` [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data() Simon Glass
                   ` (11 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The code flows through to the end of the function, so we don't need another
close() before this. Remove it.

Reported-by: Coverity (CID: 138504)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 2c8d92f..31aa43c 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -530,6 +530,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
 	if (fd < 0) {
 		fprintf(stderr, "%s: Can't open %s: %s\n",
 			params->cmdname, fname, strerror(errno));
+		ret = -EIO;
 		goto err;
 	}
 	if (write(fd, fdt, new_size) != new_size) {
@@ -538,7 +539,6 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
 		ret = -EIO;
 		goto err;
 	}
-	close(fd);
 
 	ret = 0;
 
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
  2016-03-16 13:45 ` [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data Simon Glass
  2016-03-16 13:45 ` [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions Simon Glass
                   ` (10 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The code flows through to the end of the function, so we don't need another
close() before this. Remove it.

Reported-by: Coverity (CID: 138503)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 31aa43c..8a93ea3 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -446,8 +446,6 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 		ret = -EIO;
 		goto err;
 	}
-	close(fd);
-
 	ret = 0;
 
 err:
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (2 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi() Simon Glass
                   ` (9 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

One of these is causing a coverity warning. Drop these functions and use the
standard U-Boot ones instead.

Reported-by: Coverity (CID: 138499)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 disk/part_iso.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/disk/part_iso.c b/disk/part_iso.c
index b83983b..2114faf 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <asm/unaligned.h>
 #include "part_iso.h"
 
 #ifdef HAVE_BLOCK_DEVICE
@@ -25,26 +26,6 @@
 
 static unsigned char tmpbuf[CD_SECTSIZE];
 
-/* Convert char[4] in little endian format to the host format integer
- */
-static inline unsigned long le32_to_int(unsigned char *le32)
-{
-    return ((le32[3] << 24) +
-	    (le32[2] << 16) +
-	    (le32[1] << 8) +
-	     le32[0]
-	   );
-}
-/* Convert char[2] in little endian format to the host format integer
- */
-static inline unsigned short le16_to_int(unsigned char *le16)
-{
-    return ((le16[1] << 8) +
-	   le16[0]
-	   );
-}
-
-
 /* only boot records will be listed as valid partitions */
 int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
 			   disk_partition_t *info, int verb)
@@ -103,7 +84,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
 				pbr->ident_str, dev_desc->devnum, part_num);
 		return (-1);
 	}
-	bootaddr=le32_to_int(pbr->pointer);
+	bootaddr = get_unaligned_le32(pbr->pointer);
 	PRINTF(" Boot Entry at: %08lX\n",bootaddr);
 	if (blk_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
 		if(verb)
@@ -203,7 +184,7 @@ found:
 	}
 	switch(pide->boot_media) {
 		case 0x00: /* no emulation */
-			info->size=le16_to_int(pide->sec_cnt)>>2;
+			info->size = get_unaligned_le16(pide->sec_cnt)>>2;
 			break;
 		case 0x01:	info->size=2400>>2; break; /* 1.2MByte Floppy */
 		case 0x02:	info->size=2880>>2; break; /* 1.44MByte Floppy */
@@ -211,7 +192,7 @@ found:
 		case 0x04:	info->size=2880>>2; break; /* dummy (HD Emulation) */
 		default:	info->size=0; break;
 	}
-	newblkaddr=le32_to_int(pide->rel_block_addr);
+	newblkaddr = get_unaligned_le32(pide->rel_block_addr);
 	info->start=newblkaddr;
 	PRINTF(" part %d found @ %lx size %lx\n",part_num,newblkaddr,info->size);
 	return 0;
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (3 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi() Simon Glass
                   ` (8 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

This cannot be NULL since part_print() calls this function and requires it
to be non-NULL.

Reported-by: Coverity (CID: 138498)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 disk/part_efi.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 77bdfcb..93a7e81 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -184,10 +184,6 @@ void part_print_efi(struct blk_desc *dev_desc)
 	char uuid[37];
 	unsigned char *uuid_bin;
 
-	if (!dev_desc) {
-		printf("%s: Invalid Argument(s)\n", __func__);
-		return;
-	}
 	/* This function validates AND fills in the GPT header and PTE */
 	if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
 			 gpt_head, &gpt_pte) != 1) {
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (4 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size Simon Glass
                   ` (7 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

This cannot be NULL since part_get_info() calls this function and requires
it to be non-NULL.

Reported-by: Coverity (CID: 138497)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 disk/part_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 93a7e81..fe308d7 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -240,7 +240,7 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
 	gpt_entry *gpt_pte = NULL;
 
 	/* "part" argument must be at least 1 */
-	if (!dev_desc || !info || part < 1) {
+	if (part < 1) {
 		printf("%s: Invalid Argument(s)\n", __func__);
 		return -1;
 	}
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (5 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data() Simon Glass
                   ` (6 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

There is a missing close() on the error path. Add it.

Reported-by: Coverity (CID: 138496)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/imagetool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/imagetool.c b/tools/imagetool.c
index 351211c..916ab96 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -107,6 +107,7 @@ int imagetool_get_filesize(struct image_tool_params *params, const char *fname)
 	if (fstat(fd, &sbuf) < 0) {
 		fprintf(stderr, "%s: Can't stat %s: %s\n",
 			params->cmdname, fname, strerror(errno));
+		close(fd);
 		return -1;
 	}
 	close(fd);
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (6 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data() Simon Glass
                   ` (5 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The space allocated to fdt is not freed on error. Fix it.

Reported-by: Coverity (CID: 138494)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 8a93ea3..8d58370 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -541,6 +541,7 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
 	ret = 0;
 
 err:
+	free(fdt);
 	close(fd);
 	return ret;
 }
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (7 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 10/14] mkimage: Fix missing free() " Simon Glass
                   ` (4 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The 'fdt' variable is not unmapped in all error cases. Fix this.

Reported-by: Coverity (CID: 138493)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 8d58370..bfb43b2 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -385,7 +385,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 	buf = malloc(fit_size);
 	if (!buf) {
 		ret = -ENOMEM;
-		goto err;
+		goto err_munmap;
 	}
 	buf_ptr = 0;
 
@@ -393,7 +393,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 	if (images < 0) {
 		debug("%s: Cannot find /images node: %d\n", __func__, images);
 		ret = -EINVAL;
-		goto err;
+		goto err_munmap;
 	}
 
 	for (node = fdt_first_subnode(fdt, images);
@@ -411,7 +411,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 		ret = fdt_delprop(fdt, node, "data");
 		if (ret) {
 			ret = -EPERM;
-			goto err;
+			goto err_munmap;
 		}
 		fdt_setprop_u32(fdt, node, "data-offset", buf_ptr);
 		fdt_setprop_u32(fdt, node, "data-size", len);
@@ -446,8 +446,11 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 		ret = -EIO;
 		goto err;
 	}
-	ret = 0;
+	close(fd);
+	return 0;
 
+err_munmap:
+	munmap(fdt, sbuf.st_size);
 err:
 	close(fd);
 	return ret;
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 10/14] mkimage: Fix missing free() in fit_extract_data()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (8 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build() Simon Glass
                   ` (3 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The 'buf' variable is not freed. Fix it.

Reported-by: Coverity (CID: 138492)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index bfb43b2..e628212 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -452,6 +452,8 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 err_munmap:
 	munmap(fdt, sbuf.st_size);
 err:
+	if (buf)
+		free(buf);
 	close(fd);
 	return ret;
 }
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (9 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 10/14] mkimage: Fix missing free() " Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file() Simon Glass
                   ` (2 subsequent siblings)
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

Make sure that both the error path and normal return free the buffer and
close the file.

Reported-by: Coverity (CID: 138491)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index e628212..9d553d1 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -329,7 +329,7 @@ static int fit_build(struct image_tool_params *params, const char *fname)
 	if (ret < 0) {
 		fprintf(stderr, "%s: Failed to build FIT image\n",
 			params->cmdname);
-		goto err;
+		goto err_buf;
 	}
 	size = ret;
 	fd = open(fname, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
@@ -346,9 +346,12 @@ static int fit_build(struct image_tool_params *params, const char *fname)
 		goto err;
 	}
 	close(fd);
+	free(buf);
 
 	return 0;
 err:
+	close(fd);
+err_buf:
 	free(buf);
 	return -1;
 }
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (10 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened Simon Glass
  2016-03-16 13:45 ` [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info() Simon Glass
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The file that is opened is not closed in all cases. Fix it.

Reported-by: Coverity (CID: 138490)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 9d553d1..6e5c143 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -123,13 +123,14 @@ static int fdt_property_file(struct image_tool_params *params,
 
 	ret = fdt_property_placeholder(fdt, "data", sbuf.st_size, &ptr);
 	if (ret)
-		return ret;
+		goto err;
 	ret = read(fd, ptr, sbuf.st_size);
 	if (ret != sbuf.st_size) {
 		fprintf(stderr, "%s: Can't read %s: %s\n",
 			params->cmdname, fname, strerror(errno));
 		goto err;
 	}
+	close(fd);
 
 	return 0;
 err:
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (11 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file() Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  2016-03-16 13:45 ` [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info() Simon Glass
  13 siblings, 2 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

The error path for fit_import_data() is incorrect if the second open() call
fails.

Reported-by: Coverity (CID: 138489)
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/fit_image.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 6e5c143..ddefa72 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -537,8 +537,8 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
 	if (fd < 0) {
 		fprintf(stderr, "%s: Can't open %s: %s\n",
 			params->cmdname, fname, strerror(errno));
-		ret = -EIO;
-		goto err;
+		free(fdt);
+		return -EIO;
 	}
 	if (write(fd, fdt, new_size) != new_size) {
 		debug("%s: Failed to write external data to file %s\n",
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info()
  2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
                   ` (12 preceding siblings ...)
  2016-03-16 13:45 ` [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened Simon Glass
@ 2016-03-16 13:45 ` Simon Glass
  2016-03-16 15:50   ` Marek Vasut
                     ` (2 more replies)
  13 siblings, 3 replies; 44+ messages in thread
From: Simon Glass @ 2016-03-16 13:45 UTC (permalink / raw)
  To: u-boot

This should return 0 on success, not 1. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index 1472824..18fdf73 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -193,7 +193,7 @@ int usb_stor_info(void)
 		return 1;
 	}
 
-	return 1;
+	return 0;
 }
 
 static unsigned int usb_get_max_lun(struct us_data *us)
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info()
  2016-03-16 13:45 ` [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info() Simon Glass
@ 2016-03-16 15:50   ` Marek Vasut
  2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  2 siblings, 0 replies; 44+ messages in thread
From: Marek Vasut @ 2016-03-16 15:50 UTC (permalink / raw)
  To: u-boot

On 03/16/2016 02:45 PM, Simon Glass wrote:
> This should return 0 on success, not 1. Fix it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Yikes. Thanks for finding this.

Acked-by: Marek Vasut <marex@denx.de>

> ---
> 
>  common/usb_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index 1472824..18fdf73 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -193,7 +193,7 @@ int usb_stor_info(void)
>  		return 1;
>  	}
>  
> -	return 1;
> +	return 0;
>  }
>  
>  static unsigned int usb_get_max_lun(struct us_data *us)
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data
  2016-03-16 13:45 ` [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data Simon Glass
@ 2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:08 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:31AM -0600, Simon Glass wrote:

> The munmap() call unmaps the wrong memory buffer. Fix it.
> 
> Reported-by: Coverity (CID: 138505)
> Reported-by: Coverity (CID: 138495)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/4aca066f/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data() Simon Glass
@ 2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:08 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:32AM -0600, Simon Glass wrote:

> The code flows through to the end of the function, so we don't need another
> close() before this. Remove it.
> 
> Reported-by: Coverity (CID: 138504)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/0ef2a812/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data() Simon Glass
@ 2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:08 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:33AM -0600, Simon Glass wrote:

> The code flows through to the end of the function, so we don't need another
> close() before this. Remove it.
> 
> Reported-by: Coverity (CID: 138503)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/2b3d51c5/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions
  2016-03-16 13:45 ` [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions Simon Glass
@ 2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:08 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:34AM -0600, Simon Glass wrote:

> One of these is causing a coverity warning. Drop these functions and use the
> standard U-Boot ones instead.
> 
> Reported-by: Coverity (CID: 138499)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

... but the subject says customer not custom.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/b0375b27/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi()
  2016-03-16 13:45 ` [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi() Simon Glass
@ 2016-03-17  2:08   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:08 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:35AM -0600, Simon Glass wrote:

> This cannot be NULL since part_print() calls this function and requires it
> to be non-NULL.
> 
> Reported-by: Coverity (CID: 138498)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/42efec48/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi()
  2016-03-16 13:45 ` [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi() Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:36AM -0600, Simon Glass wrote:

> This cannot be NULL since part_get_info() calls this function and requires
> it to be non-NULL.
> 
> Reported-by: Coverity (CID: 138497)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/64ca3b37/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size
  2016-03-16 13:45 ` [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:37AM -0600, Simon Glass wrote:

> There is a missing close() on the error path. Add it.
> 
> Reported-by: Coverity (CID: 138496)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/32b26755/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data() Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:38AM -0600, Simon Glass wrote:

> The space allocated to fdt is not freed on error. Fix it.
> 
> Reported-by: Coverity (CID: 138494)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/55e2e2f9/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data() Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:39AM -0600, Simon Glass wrote:

> The 'fdt' variable is not unmapped in all error cases. Fix this.
> 
> Reported-by: Coverity (CID: 138493)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/dc884e3d/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 10/14] mkimage: Fix missing free() in fit_extract_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 10/14] mkimage: Fix missing free() " Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:40AM -0600, Simon Glass wrote:

> The 'buf' variable is not freed. Fix it.
> 
> Reported-by: Coverity (CID: 138492)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/f9bf4e36/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build()
  2016-03-16 13:45 ` [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build() Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:41AM -0600, Simon Glass wrote:

> Make sure that both the error path and normal return free the buffer and
> close the file.
> 
> Reported-by: Coverity (CID: 138491)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/32435f7d/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file()
  2016-03-16 13:45 ` [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file() Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:42AM -0600, Simon Glass wrote:

> The file that is opened is not closed in all cases. Fix it.
> 
> Reported-by: Coverity (CID: 138490)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/6bf5a5dd/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened
  2016-03-16 13:45 ` [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened Simon Glass
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:43AM -0600, Simon Glass wrote:

> The error path for fit_import_data() is incorrect if the second open() call
> fails.
> 
> Reported-by: Coverity (CID: 138489)
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/8a11333f/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info()
  2016-03-16 13:45 ` [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info() Simon Glass
  2016-03-16 15:50   ` Marek Vasut
@ 2016-03-17  2:09   ` Tom Rini
  2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
  2 siblings, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-17  2:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:44AM -0600, Simon Glass wrote:

> This should return 0 on success, not 1. Fix it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/a9a612bd/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 01/14] mkimage: Fix munmap() call when importing data
  2016-03-16 13:45 ` [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data Simon Glass
  2016-03-17  2:08   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:31AM -0600, Simon Glass wrote:

> The munmap() call unmaps the wrong memory buffer. Fix it.
> 
> Reported-by: Coverity (CID: 138505)
> Reported-by: Coverity (CID: 138495)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/ba716eba/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 02/14] mkimage: Correct file being closed twice in fit_import_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data() Simon Glass
  2016-03-17  2:08   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:32AM -0600, Simon Glass wrote:

> The code flows through to the end of the function, so we don't need another
> close() before this. Remove it.
> 
> Reported-by: Coverity (CID: 138504)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/6970db11/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 03/14] mkimage: Correct file being closed twice in fit_extract_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data() Simon Glass
  2016-03-17  2:08   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:33AM -0600, Simon Glass wrote:

> The code flows through to the end of the function, so we don't need another
> close() before this. Remove it.
> 
> Reported-by: Coverity (CID: 138503)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/0742f608/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 04/14] part_iso: Drop the customer unaligned access functions
  2016-03-16 13:45 ` [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions Simon Glass
  2016-03-17  2:08   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:34AM -0600, Simon Glass wrote:

> One of these is causing a coverity warning. Drop these functions and use the
> standard U-Boot ones instead.
> 
> Reported-by: Coverity (CID: 138499)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/1c659e03/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi()
  2016-03-16 13:45 ` [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi() Simon Glass
  2016-03-17  2:08   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:35AM -0600, Simon Glass wrote:

> This cannot be NULL since part_print() calls this function and requires it
> to be non-NULL.
> 
> Reported-by: Coverity (CID: 138498)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/169c1427/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 06/14] part_efi: Drop NULL check in part_get_info_efi()
  2016-03-16 13:45 ` [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi() Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:36AM -0600, Simon Glass wrote:

> This cannot be NULL since part_get_info() calls this function and requires
> it to be non-NULL.
> 
> Reported-by: Coverity (CID: 138497)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/3c1c25ea/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 07/14] mkimage: Close the file when unable to get its size
  2016-03-16 13:45 ` [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:37AM -0600, Simon Glass wrote:

> There is a missing close() on the error path. Add it.
> 
> Reported-by: Coverity (CID: 138496)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/0e66ffe2/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 08/14] mkimage: Add a missing free() to fit_import_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data() Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:38AM -0600, Simon Glass wrote:

> The space allocated to fdt is not freed on error. Fix it.
> 
> Reported-by: Coverity (CID: 138494)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/1f92511b/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 09/14] mkimage: Fix error path in fit_extract_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data() Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  1:59   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  1:59 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:39AM -0600, Simon Glass wrote:

> The 'fdt' variable is not unmapped in all error cases. Fix this.
> 
> Reported-by: Coverity (CID: 138493)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/bf94f40d/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 10/14] mkimage: Fix missing free() in fit_extract_data()
  2016-03-16 13:45 ` [U-Boot] [PATCH 10/14] mkimage: Fix missing free() " Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  2:00   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  2:00 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:40AM -0600, Simon Glass wrote:

> The 'buf' variable is not freed. Fix it.
> 
> Reported-by: Coverity (CID: 138492)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/40db93b1/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 11/14] mkimage: Fix missing free() and close() in fit_build()
  2016-03-16 13:45 ` [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build() Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  2:00   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  2:00 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:41AM -0600, Simon Glass wrote:

> Make sure that both the error path and normal return free the buffer and
> close the file.
> 
> Reported-by: Coverity (CID: 138491)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/12ca32e2/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 12/14] mkimage: Ensure file is closed in fdt_property_file()
  2016-03-16 13:45 ` [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file() Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  2:00   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  2:00 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:42AM -0600, Simon Glass wrote:

> The file that is opened is not closed in all cases. Fix it.
> 
> Reported-by: Coverity (CID: 138490)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/8099caa6/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 13/14] mkimage: Don't close the file if it wasn't opened
  2016-03-16 13:45 ` [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened Simon Glass
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  2:00   ` Tom Rini
  1 sibling, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  2:00 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:43AM -0600, Simon Glass wrote:

> The error path for fit_import_data() is incorrect if the second open() call
> fails.
> 
> Reported-by: Coverity (CID: 138489)
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/93552d29/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [U-Boot] [U-Boot, 14/14] usb: Correct return value in usb_stor_info()
  2016-03-16 13:45 ` [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info() Simon Glass
  2016-03-16 15:50   ` Marek Vasut
  2016-03-17  2:09   ` Tom Rini
@ 2016-03-23  2:00   ` Tom Rini
  2 siblings, 0 replies; 44+ messages in thread
From: Tom Rini @ 2016-03-23  2:00 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 16, 2016 at 07:45:44AM -0600, Simon Glass wrote:

> This should return 0 on success, not 1. Fix it.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Acked-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/03cf43d1/attachment.sig>

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2016-03-23  2:00 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-16 13:45 [U-Boot] [PATCH 00/14] dm: Fix various issues reported by coverity Simon Glass
2016-03-16 13:45 ` [U-Boot] [PATCH 01/14] mkimage: Fix munmap() call when importing data Simon Glass
2016-03-17  2:08   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 02/14] mkimage: Correct file being closed twice in fit_import_data() Simon Glass
2016-03-17  2:08   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 03/14] mkimage: Correct file being closed twice in fit_extract_data() Simon Glass
2016-03-17  2:08   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions Simon Glass
2016-03-17  2:08   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 05/14] part_efi: Drop the NULL check on dev_desc in part_print_efi() Simon Glass
2016-03-17  2:08   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 06/14] part_efi: Drop NULL check in part_get_info_efi() Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 07/14] mkimage: Close the file when unable to get its size Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 08/14] mkimage: Add a missing free() to fit_import_data() Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 09/14] mkimage: Fix error path in fit_extract_data() Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  1:59   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 10/14] mkimage: Fix missing free() " Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 11/14] mkimage: Fix missing free() and close() in fit_build() Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 12/14] mkimage: Ensure file is closed in fdt_property_file() Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 13/14] mkimage: Don't close the file if it wasn't opened Simon Glass
2016-03-17  2:09   ` Tom Rini
2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini
2016-03-16 13:45 ` [U-Boot] [PATCH 14/14] usb: Correct return value in usb_stor_info() Simon Glass
2016-03-16 15:50   ` Marek Vasut
2016-03-17  2:09   ` Tom Rini
2016-03-23  2:00   ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.