diff options
author | Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> | 2015-07-10 15:24:35 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-17 11:59:47 +1000 |
commit | cd0d009183b0a0ce2e048c90d9f94ab06f297b1d (patch) | |
tree | 465e8005d3cc2fc59f933e59bb4e75ae9e15b3bf /hdata/memory.c | |
parent | 8150b63914fd4929e874bc4614da08be56c69512 (diff) | |
download | talos-skiboot-cd0d009183b0a0ce2e048c90d9f94ab06f297b1d.tar.gz talos-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.c | 4 |
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); |