summaryrefslogtreecommitdiffstats
path: root/trusty
diff options
context:
space:
mode:
authorYan, Shaopu2017-11-28 13:58:40 -0600
committerandroid-build-merger2017-11-28 13:58:40 -0600
commita3e487671550d84a21755457bf2f3e39db4e00df (patch)
treeff47fa363ccbc2d88dc7a05bed7ddba06bf27fb3 /trusty
parent0bdb39ef5d86e888d44c624d91d28c860d03b430 (diff)
parentf03f2a5cd7a7ad7a2cfa3c2ae5f512c0ddbeeb80 (diff)
downloadplatform-system-core-a3e487671550d84a21755457bf2f3e39db4e00df.tar.gz
platform-system-core-a3e487671550d84a21755457bf2f3e39db4e00df.tar.xz
platform-system-core-a3e487671550d84a21755457bf2f3e39db4e00df.zip
Merge "add null pointer check for msg buffer"
am: f03f2a5cd7 Change-Id: I988bd6cf38aae918dd6b8c547b6db92501925685
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