summaryrefslogtreecommitdiffstats
path: root/trusty
diff options
context:
space:
mode:
authorYan, Shaopu2017-11-27 23:08:14 -0600
committerYan, Shaopu2017-11-28 01:17:27 -0600
commit53eb0cb5a3c3c754f623469e8535ea6559fb34bc (patch)
treecb723b91b34db4f4ef44c65cfe11a2f4c247ed5c /trusty
parent23cc38d44055fe12d544c59202375f10436c1904 (diff)
downloadplatform-system-core-53eb0cb5a3c3c754f623469e8535ea6559fb34bc.tar.gz
platform-system-core-53eb0cb5a3c3c754f623469e8535ea6559fb34bc.tar.xz
platform-system-core-53eb0cb5a3c3c754f623469e8535ea6559fb34bc.zip
add null pointer check for msg buffer
Test: Build Change-Id: I94e08ccc8372449f11f6e673b6449c50d7eef4f9
Diffstat (limited to 'trusty')
-rw-r--r--trusty/keymaster/trusty_keymaster_ipc.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/trusty/keymaster/trusty_keymaster_ipc.cpp b/trusty/keymaster/trusty_keymaster_ipc.cpp
index fbd0eb396..686e7aec6 100644
--- a/trusty/keymaster/trusty_keymaster_ipc.cpp
+++ b/trusty/keymaster/trusty_keymaster_ipc.cpp
@@ -55,6 +55,11 @@ int trusty_keymaster_call(uint32_t cmd, void* in, uint32_t in_size, uint8_t* out
55 55
56 size_t msg_size = in_size + sizeof(struct keymaster_message); 56 size_t msg_size = in_size + sizeof(struct keymaster_message);
57 struct keymaster_message* msg = reinterpret_cast<struct keymaster_message*>(malloc(msg_size)); 57 struct keymaster_message* msg = reinterpret_cast<struct keymaster_message*>(malloc(msg_size));
58 if (!msg) {
59 ALOGE("failed to allocate msg buffer\n");
60 return -EINVAL;
61 }
62
58 msg->cmd = cmd; 63 msg->cmd = cmd;
59 memcpy(msg->payload, in, in_size); 64 memcpy(msg->payload, in, in_size);
60 65