{"action":"created","comment":{"url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments/53021419","id":53021419,"diff_hunk":"@@ -162,290 +176,274 @@ static TEE_Result propget_get_property(TEE_PropSetHandle h, char *name,\n \t\t\treturn res;\n \n \t\tif (idx < eps_len)\n-\t\t\treturn propget_get_ext_prop(eps + idx, pv);\n+\t\t\treturn propget_get_ext_prop(eps + idx, type, buf, len);\n \t\tidx -= eps_len;\n \n-\t\tsize = sizeof(pv->u);\n \t\tres = utee_get_property((unsigned long)pe->prop_set, idx,\n-\t\t\t\t\t0, 0, &pv->u, &size, &prop_type);\n+\t\t\t\t\t0, 0, buf, len, &prop_type);\n \t\tif (res == TEE_ERROR_ITEM_NOT_FOUND)\n \t\t\tres = TEE_ERROR_BAD_PARAMETERS;\n \t}\n \n-\tif (res == TEE_SUCCESS)\n-\t\tpv->type = prop_type;\n+\t*type = prop_type;\n \treturn res;\n }\n \n TEE_Result TEE_GetPropertyAsString(TEE_PropSetHandle propsetOrEnumerator,\n-\t\t\t\t   char *name, char *valueBuffer,\n-\t\t\t\t   uint32_t *valueBufferLen)\n+\t\t\t\t   char *name, char *value,\n+\t\t\t\t   uint32_t *value_len)\n {\n \tTEE_Result res;\n-\tstruct prop_value pv;\n \tsize_t l;\n-\tsize_t bufferlen;\n+\tenum user_ta_prop_type type;\n+\tvoid *tmp_buf = 0;\n+\tuint32_t tmp_len;\n+\tuint32_t uint32_val;\n+\tTEE_UUID uuid_val;\n+\tTEE_Identity identity_val;\n \n-\tif (valueBuffer == NULL || valueBufferLen == NULL) {\n+\tif (!value || !value_len) {\n \t\tres = TEE_ERROR_BAD_PARAMETERS;\n-\t\tgoto err;\n+\t\tgoto out;\n \t}\n \n-\tbufferlen = *valueBufferLen;\n+\ttmp_len = *value_len;\n+\tif (tmp_len < sizeof(TEE_Identity))\n+\t\ttmp_len = sizeof(TEE_Identity);\n+\ttmp_buf = malloc(tmp_len);\n+\tif (!tmp_buf) {\n+\t\tres = TEE_ERROR_OUT_OF_MEMORY;\n+\t\tgoto out;\n+\t}\n \n-\tres = propget_get_property(propsetOrEnumerator, name, &pv);\n-\tif (res != TEE_SUCCESS)\n-\t\tgoto err;\n+\tres = propget_get_property(propsetOrEnumerator, name, &type,\n+\t\t\t\t   tmp_buf, &tmp_len);\n+\tif (res != TEE_SUCCESS) {\n+\t\tif (res == TEE_ERROR_SHORT_BUFFER)\n+\t\t\t*value_len = tmp_len;\n+\t\tgoto out;\n+\t}\n \n-\tswitch (pv.type) {\n+\tswitch (type) {\n \tcase USER_TA_PROP_TYPE_BOOL:\n-\t\tl = strlcpy(valueBuffer, pv.u.bool_val ? \"true\" : \"false\",\n-\t\t\t    bufferlen);\n+\t\tuint32_val = *((unsigned int *)tmp_buf);\n+\t\tl = strlcpy(value, (uint32_val ? \"true\" : \"false\"),\n+\t\t\t    *value_len);\n \t\tbreak;\n \n \tcase USER_TA_PROP_TYPE_U32:\n-\t\tl = snprintf(valueBuffer, bufferlen, \"%u\",\n-\t\t\t     (unsigned int)pv.u.int_val);\n+\t\tuint32_val = *((unsigned int *)tmp_buf);\n+\t\tl = snprintf(value, *value_len, \"%u\", uint32_val);\n \t\tbreak;\n \n \tcase USER_TA_PROP_TYPE_UUID:\n-\t\tl = snprintf(valueBuffer, bufferlen,\n+\t\tuuid_val = *((TEE_UUID *)tmp_buf);\n+\t\tl = snprintf(value, *value_len,\n \t\t\t     \"%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x\",\n-\t\t\t     (unsigned int)pv.u.uuid_val.timeLow,\n-\t\t\t     pv.u.uuid_val.timeMid,\n-\t\t\t     pv.u.uuid_val.timeHiAndVersion,\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[0],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[1],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[2],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[3],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[4],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[5],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[6],\n-\t\t\t     pv.u.uuid_val.clockSeqAndNode[7]);\n+\t\t\t     (unsigned int)uuid_val.timeLow,","path":"lib/libutee/tee_api_property.c","position":212,"original_position":212,"commit_id":"cdf86999d520ee6b3dbecf288a34151bd076240a","original_commit_id":"cdf86999d520ee6b3dbecf288a34151bd076240a","user":{"login":"jenswi-linaro","id":6150306,"avatar_url":"https://avatars.githubusercontent.com/u/6150306?v=3","gravatar_id":"","url":"https://api.github.com/users/jenswi-linaro","html_url":"https://github.com/jenswi-linaro","followers_url":"https://api.github.com/users/jenswi-linaro/followers","following_url":"https://api.github.com/users/jenswi-linaro/following{/other_user}","gists_url":"https://api.github.com/users/jenswi-linaro/gists{/gist_id}","starred_url":"https://api.github.com/users/jenswi-linaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenswi-linaro/subscriptions","organizations_url":"https://api.github.com/users/jenswi-linaro/orgs","repos_url":"https://api.github.com/users/jenswi-linaro/repos","events_url":"https://api.github.com/users/jenswi-linaro/events{/privacy}","received_events_url":"https://api.github.com/users/jenswi-linaro/received_events","type":"User","site_admin":false},"body":"Use proper format code instead of casting.","created_at":"2016-02-16T15:02:08Z","updated_at":"2016-02-16T15:02:08Z","html_url":"https://github.com/OP-TEE/optee_os/pull/651#discussion_r53021419","pull_request_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651","_links":{"self":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments/53021419"},"html":{"href":"https://github.com/OP-TEE/optee_os/pull/651#discussion_r53021419"},"pull_request":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651"}}},"pull_request":{"url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651","id":59495812,"html_url":"https://github.com/OP-TEE/optee_os/pull/651","diff_url":"https://github.com/OP-TEE/optee_os/pull/651.diff","patch_url":"https://github.com/OP-TEE/optee_os/pull/651.patch","issue_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/651","number":651,"state":"open","locked":false,"title":"Properties: fix and clean","user":{"login":"pascal-brand-st-dev","id":6542303,"avatar_url":"https://avatars.githubusercontent.com/u/6542303?v=3","gravatar_id":"","url":"https://api.github.com/users/pascal-brand-st-dev","html_url":"https://github.com/pascal-brand-st-dev","followers_url":"https://api.github.com/users/pascal-brand-st-dev/followers","following_url":"https://api.github.com/users/pascal-brand-st-dev/following{/other_user}","gists_url":"https://api.github.com/users/pascal-brand-st-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pascal-brand-st-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascal-brand-st-dev/subscriptions","organizations_url":"https://api.github.com/users/pascal-brand-st-dev/orgs","repos_url":"https://api.github.com/users/pascal-brand-st-dev/repos","events_url":"https://api.github.com/users/pascal-brand-st-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pascal-brand-st-dev/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-16T14:15:18Z","updated_at":"2016-02-16T15:02:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"05596d7120abb2443968c9913a95b5c5360df3d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651/commits","review_comments_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651/comments","review_comment_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/651/comments","statuses_url":"https://api.github.com/repos/OP-TEE/optee_os/statuses/cdf86999d520ee6b3dbecf288a34151bd076240a","head":{"label":"pascal-brand-st-dev:moreprops","ref":"moreprops","sha":"cdf86999d520ee6b3dbecf288a34151bd076240a","user":{"login":"pascal-brand-st-dev","id":6542303,"avatar_url":"https://avatars.githubusercontent.com/u/6542303?v=3","gravatar_id":"","url":"https://api.github.com/users/pascal-brand-st-dev","html_url":"https://github.com/pascal-brand-st-dev","followers_url":"https://api.github.com/users/pascal-brand-st-dev/followers","following_url":"https://api.github.com/users/pascal-brand-st-dev/following{/other_user}","gists_url":"https://api.github.com/users/pascal-brand-st-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pascal-brand-st-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascal-brand-st-dev/subscriptions","organizations_url":"https://api.github.com/users/pascal-brand-st-dev/orgs","repos_url":"https://api.github.com/users/pascal-brand-st-dev/repos","events_url":"https://api.github.com/users/pascal-brand-st-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pascal-brand-st-dev/received_events","type":"User","site_admin":false},"repo":{"id":20769654,"name":"optee_os","full_name":"pascal-brand-st-dev/optee_os","owner":{"login":"pascal-brand-st-dev","id":6542303,"avatar_url":"https://avatars.githubusercontent.com/u/6542303?v=3","gravatar_id":"","url":"https://api.github.com/users/pascal-brand-st-dev","html_url":"https://github.com/pascal-brand-st-dev","followers_url":"https://api.github.com/users/pascal-brand-st-dev/followers","following_url":"https://api.github.com/users/pascal-brand-st-dev/following{/other_user}","gists_url":"https://api.github.com/users/pascal-brand-st-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pascal-brand-st-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascal-brand-st-dev/subscriptions","organizations_url":"https://api.github.com/users/pascal-brand-st-dev/orgs","repos_url":"https://api.github.com/users/pascal-brand-st-dev/repos","events_url":"https://api.github.com/users/pascal-brand-st-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pascal-brand-st-dev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pascal-brand-st-dev/optee_os","description":"Trusted side of the TEE","fork":true,"url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os","forks_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/forks","keys_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/teams","hooks_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/hooks","issue_events_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/issues/events{/number}","events_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/events","assignees_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/assignees{/user}","branches_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/branches{/branch}","tags_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/tags","blobs_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/git/refs{/sha}","trees_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/statuses/{sha}","languages_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/languages","stargazers_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/stargazers","contributors_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/contributors","subscribers_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/subscribers","subscription_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/subscription","commits_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/commits{/sha}","git_commits_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/git/commits{/sha}","comments_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/comments{/number}","issue_comment_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/issues/comments{/number}","contents_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/contents/{+path}","compare_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/merges","archive_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/downloads","issues_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/issues{/number}","pulls_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/pulls{/number}","milestones_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/milestones{/number}","notifications_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/labels{/name}","releases_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/releases{/id}","deployments_url":"https://api.github.com/repos/pascal-brand-st-dev/optee_os/deployments","created_at":"2014-06-12T14:09:53Z","updated_at":"2015-04-28T06:00:43Z","pushed_at":"2016-02-16T14:09:34Z","git_url":"git://github.com/pascal-brand-st-dev/optee_os.git","ssh_url":"git@github.com:pascal-brand-st-dev/optee_os.git","clone_url":"https://github.com/pascal-brand-st-dev/optee_os.git","svn_url":"https://github.com/pascal-brand-st-dev/optee_os","homepage":null,"size":4319,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OP-TEE:master","ref":"master","sha":"64a5011e3774c8664fefc6dff966d0096cdd56d7","user":{"login":"OP-TEE","id":7488961,"avatar_url":"https://avatars.githubusercontent.com/u/7488961?v=3","gravatar_id":"","url":"https://api.github.com/users/OP-TEE","html_url":"https://github.com/OP-TEE","followers_url":"https://api.github.com/users/OP-TEE/followers","following_url":"https://api.github.com/users/OP-TEE/following{/other_user}","gists_url":"https://api.github.com/users/OP-TEE/gists{/gist_id}","starred_url":"https://api.github.com/users/OP-TEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP-TEE/subscriptions","organizations_url":"https://api.github.com/users/OP-TEE/orgs","repos_url":"https://api.github.com/users/OP-TEE/repos","events_url":"https://api.github.com/users/OP-TEE/events{/privacy}","received_events_url":"https://api.github.com/users/OP-TEE/received_events","type":"Organization","site_admin":false},"repo":{"id":20193261,"name":"optee_os","full_name":"OP-TEE/optee_os","owner":{"login":"OP-TEE","id":7488961,"avatar_url":"https://avatars.githubusercontent.com/u/7488961?v=3","gravatar_id":"","url":"https://api.github.com/users/OP-TEE","html_url":"https://github.com/OP-TEE","followers_url":"https://api.github.com/users/OP-TEE/followers","following_url":"https://api.github.com/users/OP-TEE/following{/other_user}","gists_url":"https://api.github.com/users/OP-TEE/gists{/gist_id}","starred_url":"https://api.github.com/users/OP-TEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP-TEE/subscriptions","organizations_url":"https://api.github.com/users/OP-TEE/orgs","repos_url":"https://api.github.com/users/OP-TEE/repos","events_url":"https://api.github.com/users/OP-TEE/events{/privacy}","received_events_url":"https://api.github.com/users/OP-TEE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OP-TEE/optee_os","description":"Trusted side of the TEE","fork":false,"url":"https://api.github.com/repos/OP-TEE/optee_os","forks_url":"https://api.github.com/repos/OP-TEE/optee_os/forks","keys_url":"https://api.github.com/repos/OP-TEE/optee_os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OP-TEE/optee_os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OP-TEE/optee_os/teams","hooks_url":"https://api.github.com/repos/OP-TEE/optee_os/hooks","issue_events_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/events{/number}","events_url":"https://api.github.com/repos/OP-TEE/optee_os/events","assignees_url":"https://api.github.com/repos/OP-TEE/optee_os/assignees{/user}","branches_url":"https://api.github.com/repos/OP-TEE/optee_os/branches{/branch}","tags_url":"https://api.github.com/repos/OP-TEE/optee_os/tags","blobs_url":"https://api.github.com/repos/OP-TEE/optee_os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OP-TEE/optee_os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OP-TEE/optee_os/git/refs{/sha}","trees_url":"https://api.github.com/repos/OP-TEE/optee_os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OP-TEE/optee_os/statuses/{sha}","languages_url":"https://api.github.com/repos/OP-TEE/optee_os/languages","stargazers_url":"https://api.github.com/repos/OP-TEE/optee_os/stargazers","contributors_url":"https://api.github.com/repos/OP-TEE/optee_os/contributors","subscribers_url":"https://api.github.com/repos/OP-TEE/optee_os/subscribers","subscription_url":"https://api.github.com/repos/OP-TEE/optee_os/subscription","commits_url":"https://api.github.com/repos/OP-TEE/optee_os/commits{/sha}","git_commits_url":"https://api.github.com/repos/OP-TEE/optee_os/git/commits{/sha}","comments_url":"https://api.github.com/repos/OP-TEE/optee_os/comments{/number}","issue_comment_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/comments{/number}","contents_url":"https://api.github.com/repos/OP-TEE/optee_os/contents/{+path}","compare_url":"https://api.github.com/repos/OP-TEE/optee_os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OP-TEE/optee_os/merges","archive_url":"https://api.github.com/repos/OP-TEE/optee_os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OP-TEE/optee_os/downloads","issues_url":"https://api.github.com/repos/OP-TEE/optee_os/issues{/number}","pulls_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls{/number}","milestones_url":"https://api.github.com/repos/OP-TEE/optee_os/milestones{/number}","notifications_url":"https://api.github.com/repos/OP-TEE/optee_os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OP-TEE/optee_os/labels{/name}","releases_url":"https://api.github.com/repos/OP-TEE/optee_os/releases{/id}","deployments_url":"https://api.github.com/repos/OP-TEE/optee_os/deployments","created_at":"2014-05-26T17:18:57Z","updated_at":"2016-02-16T09:00:19Z","pushed_at":"2016-02-16T14:15:19Z","git_url":"git://github.com/OP-TEE/optee_os.git","ssh_url":"git@github.com:OP-TEE/optee_os.git","clone_url":"https://github.com/OP-TEE/optee_os.git","svn_url":"https://github.com/OP-TEE/optee_os","homepage":null,"size":8529,"stargazers_count":91,"watchers_count":91,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":18,"forks":95,"open_issues":18,"watchers":91,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651"},"html":{"href":"https://github.com/OP-TEE/optee_os/pull/651"},"issue":{"href":"https://api.github.com/repos/OP-TEE/optee_os/issues/651"},"comments":{"href":"https://api.github.com/repos/OP-TEE/optee_os/issues/651/comments"},"review_comments":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651/comments"},"review_comment":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/651/commits"},"statuses":{"href":"https://api.github.com/repos/OP-TEE/optee_os/statuses/cdf86999d520ee6b3dbecf288a34151bd076240a"}}}}