qseecom: change the number of bytes to compare app names
keymaster app has two names with different length: "keymaster" and
"keymaste". To compare the app names correctly, the shorter name
length is choosen for memcmp in __qseecom_send_cmd.
Change-Id: I5f0dff7f9756362be40cc64985b65bc2268d734f
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: William Clark <wclark@codeaurora.org>
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c
index 9d294f0..cfdaa58 100644
--- a/drivers/misc/qseecom.c
+++ b/drivers/misc/qseecom.c
@@ -1370,6 +1370,7 @@
unsigned long flags;
struct qseecom_registered_app_list *ptr_app;
bool found_app = false;
+ int name_len = 0;
if (req->cmd_req_buf == NULL || req->resp_buf == NULL) {
pr_err("cmd buffer or response buffer is null\n");
@@ -1415,10 +1416,11 @@
spin_lock_irqsave(&qseecom.registered_app_list_lock, flags);
list_for_each_entry(ptr_app, &qseecom.registered_app_list_head,
list) {
+ name_len = min(strlen(data->client.app_name),
+ strlen(ptr_app->app_name));
if ((ptr_app->app_id == data->client.app_id) &&
(!memcmp((void *)ptr_app->app_name,
- (void *)data->client.app_name,
- strlen(data->client.app_name)))) {
+ (void *)data->client.app_name, name_len))) {
found_app = true;
break;
}