summaryrefslogtreecommitdiffstats
path: root/hdata/memory.c
diff options
context:
space:
mode:
authorKamalesh Babulal <kamalesh@linux.vnet.ibm.com>2015-07-10 15:24:35 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-07-17 11:59:47 +1000
commitcd0d009183b0a0ce2e048c90d9f94ab06f297b1d (patch)
tree465e8005d3cc2fc59f933e59bb4e75ae9e15b3bf /hdata/memory.c
parent8150b63914fd4929e874bc4614da08be56c69512 (diff)
downloadblackbird-skiboot-cd0d009183b0a0ce2e048c90d9f94ab06f297b1d.tar.gz
blackbird-skiboot-cd0d009183b0a0ce2e048c90d9f94ab06f297b1d.zip
hdata/memory: Introduce zalloc() return check
In add_size_to_ram_area(), Introduce check for memory allocation failure, before using it. Fixes Coverity defect#97840. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/memory.c')
-rw-r--r--hdata/memory.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hdata/memory.c b/hdata/memory.c
index 6bc86959..58acd632 100644
--- a/hdata/memory.c
+++ b/hdata/memory.c
@@ -244,6 +244,10 @@ static void add_size_to_ram_area(struct dt_node *ram_node,
return;
str = zalloc(kwsz + 1);
+ if (!str){
+ prerror("Allocation failed\n");
+ return;
+ }
memcpy(str, kw, kwsz);
dt_add_property_string(ram_node, "size", str);
free(str);
OpenPOWER on IntegriCloud