Aayush Kashyap has uploaded this change for review.

View Change

sdfp.c: fixed initalization warining in probe_spi_sfdp
serprog.c: fixed expected nonnull value warning in sp_stream_buffer_op

This patch fixes warnings relating to accessing uninitialized memory in
sfdp.c and calling a function that expects non-NULL parameters with a
NULL value in serprog.c.

Change-Id: Ifa03d439e3cb572a708ff30834bc237500efedd5
Signed-off-by: Aayush Kashyap <kashyapaayush32@gmail.com>
---
M serprog.c
M sfdp.c
2 files changed, 4 insertions(+), 3 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/74/63674/1
diff --git a/serprog.c b/serprog.c
index 2bbf44b..3c5d28b 100644
--- a/serprog.c
+++ b/serprog.c
@@ -291,7 +291,8 @@
return 1;
}
sp[0] = cmd;
- memcpy(&(sp[1]), parms, parmlen);
+ if(parms)
+ memcpy(&(sp[1]), parms, parmlen);

if (sp_streamed_transmit_bytes >= (1 + parmlen + sp_device_serbuf_size)) {
if (sp_flush_stream() != 0) {
diff --git a/sfdp.c b/sfdp.c
index b549417..fbbe803 100644
--- a/sfdp.c
+++ b/sfdp.c
@@ -295,8 +295,8 @@
nph + 1, nph);

/* Fetch all parameter headers, even if we don't use them all (yet). */
- hbuf = malloc((nph + 1) * 8);
- hdrs = malloc((nph + 1) * sizeof(*hdrs));
+ hbuf = calloc((nph + 1), 8);
+ hdrs = calloc((nph + 1), sizeof(*hdrs));
if (hbuf == NULL || hdrs == NULL ) {
msg_gerr("Out of memory!\n");
goto cleanup_hdrs;

To view, visit change 63674. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifa03d439e3cb572a708ff30834bc237500efedd5
Gerrit-Change-Number: 63674
Gerrit-PatchSet: 1
Gerrit-Owner: Aayush Kashyap <kashyapaayush32@gmail.com>
Gerrit-MessageType: newchange