Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17880
-gerrit
commit f025a5c4ae1bb4aa4452279da4c896f468adda86
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 14:59:37 2016 +0100
util/broadcom: Initialize variable
It's later tested for NULL, but never initialized to make that test work
reliably.
Change-Id: Iadee1af224507a6dd39956306f3eafa687895176
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1323515
---
util/broadcom/secimage/sbi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/broadcom/secimage/sbi.c b/util/broadcom/secimage/sbi.c
index 58d4a39..8718f14 100644
--- a/util/broadcom/secimage/sbi.c
+++ b/util/broadcom/secimage/sbi.c
@@ -77,12 +77,12 @@ int AddImagePayload(char *h, char *filename, unsigned int filesize)
*---------------------------------------------------------------------*/
int CreateSecureBootImage(int ac, char **av)
{
- char *outfile, *configfile, *arg, *privkey = NULL, *bl = NULL;
+ char *configfile = NULL, *arg, *privkey = NULL, *bl = NULL;
int status = 0;
uint32_t sbiLen;
struct stat file_stat;
uint32_t add_header = 1;
- outfile = *av;
+ char *outfile = *av;
unsigned int filesize;
char *buf;
--ac; ++av;
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17879
-gerrit
commit af356203e898a3ccb2f1da5d9e8fb04b54a394a1
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 14:57:04 2016 +0100
util/broadcom: Close file after use
Change-Id: Ieea7ac7fbc618cd12f843f1606f9ebab37cae67e
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1323508
---
util/broadcom/secimage/misc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/broadcom/secimage/misc.c b/util/broadcom/secimage/misc.c
index fa9f8c5..0d0cf0b 100644
--- a/util/broadcom/secimage/misc.c
+++ b/util/broadcom/secimage/misc.c
@@ -53,5 +53,6 @@ void FillHeaderFromConfigFile(char *h, char *ConfigFileName)
h1->Reserved = Reserved;
}
}
+ fclose(fp);
}
}
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17878
-gerrit
commit cbf3abdff3c4b942e8ccca3b9ee67800772cf3da
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 14:55:10 2016 +0100
util/broadcom: Terminate string
filebuffer is treated like a string, so it should be zero-terminated
like a string.
Change-Id: I078aa39906394be64023424731fe0c7ae2019899
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1323473
---
util/broadcom/secimage/misc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/broadcom/secimage/misc.c b/util/broadcom/secimage/misc.c
index a64c448..fa9f8c5 100644
--- a/util/broadcom/secimage/misc.c
+++ b/util/broadcom/secimage/misc.c
@@ -15,7 +15,7 @@
#include <string.h>
#include "secimage.h"
-static unsigned char filebuffer[2048];
+static unsigned char filebuffer[2049];
void FillHeaderFromConfigFile(char *h, char *ConfigFileName)
{
@@ -32,6 +32,7 @@ void FillHeaderFromConfigFile(char *h, char *ConfigFileName)
if (fp != NULL) {
printf("\r\n Reading config information from file \r\n");
byte_count = fread(filebuffer, 1, 2048, fp);
+ filebuffer[2048] = 0;
if (byte_count > 0) {
ptr = strstr((char *)filebuffer, "Tag=");
if (ptr) {
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17877
-gerrit
commit 6bf52a7f023043a71a99e125148d5a8273176379
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 14:53:23 2016 +0100
util/broadcom: Check for successful file access
Change-Id: I5c77b3c5ea3fbc249a8c564a521c2c3c45e1c560
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1323510
---
util/broadcom/secimage/io.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/util/broadcom/secimage/io.c b/util/broadcom/secimage/io.c
index d71065c..e2ba693 100644
--- a/util/broadcom/secimage/io.c
+++ b/util/broadcom/secimage/io.c
@@ -73,6 +73,10 @@ int DataRead(char *filename, uint8_t *buf, int *length)
return -1;
}
len = FileSizeGet(file);
+ if (len < 0) {
+ printf("Unable to seek in file: %s\n", filename);
+ return -1;
+ }
if (len < *length)
*length = len;
else
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17876
-gerrit
commit e9a4a697c50c46d28b48ccae971dcbe632c7c1b8
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 14:51:08 2016 +0100
util/broadcom: close file on error
Change-Id: I5193c6a9f08398b881c971c7175654ba5775b34a
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1323509
---
util/broadcom/secimage/io.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/broadcom/secimage/io.c b/util/broadcom/secimage/io.c
index c32a06d..d71065c 100644
--- a/util/broadcom/secimage/io.c
+++ b/util/broadcom/secimage/io.c
@@ -81,6 +81,7 @@ int DataRead(char *filename, uint8_t *buf, int *length)
if (fread((uint8_t *)buf, 1, len, file) != len) {
printf("Error reading data (%d bytes) from file: %s\n",
len, filename);
+ fclose(file);
return -1;
}
fclose(file);
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17875
-gerrit
commit 1b3b651de641df4bef8f2c0d2f9acd8660e34571
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 14:47:29 2016 +0100
mediatek/mt8173: Check the right set of bits in USB controller
Change-Id: Ic1d1b85a1d7e85b555a93b3a0b55fe310b26e34a
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1353362
---
src/soc/mediatek/mt8173/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/soc/mediatek/mt8173/usb.c b/src/soc/mediatek/mt8173/usb.c
index ac07646..1dccfc9 100644
--- a/src/soc/mediatek/mt8173/usb.c
+++ b/src/soc/mediatek/mt8173/usb.c
@@ -99,7 +99,7 @@ static int check_ip_clk_status(void)
u3_port_num = CAP_U3_PORT_NUM(read32(&ippc_regs->ip_xhci_cap));
check_bits = STS1_SYSPLL_STABLE | STS1_REF_RST | STS1_SYS125_RST;
- check_bits = (u3_port_num ? STS1_U3_MAC_RST : 0);
+ check_bits |= (u3_port_num ? STS1_U3_MAC_RST : 0);
stopwatch_init_usecs_expire(&sw, 50000);
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17860
-gerrit
commit a707f58edd0f525fdd6accf9d4fe8d17df0f852a
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Wed Dec 14 16:11:58 2016 +0100
util/cbfstool: check that buffer_create worked
We might not care much about this buffer, but we really use it later
on...
Change-Id: Ia16270f836d05d8b454e77de7b5babeb6bb05d6d
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1294797
---
util/cbfstool/cbfstool.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 7a71427..d3c15e0 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -776,7 +776,8 @@ static int cbfs_create(void)
struct buffer bootblock;
if (!param.bootblock) {
DEBUG("-B not given, creating image without bootblock.\n");
- buffer_create(&bootblock, 0, "(dummy)");
+ if (buffer_create(&bootblock, 0, "(dummy)") != 0)
+ return 1;
} else if (buffer_from_file(&bootblock, param.bootblock)) {
return 1;
}