{"action":"created","comment":{"url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/comments/87814796","pull_request_review_id":8410629,"id":87814796,"diff_hunk":"@@ -331,6 +338,59 @@ bool _sg_is_vpd_page_supported(uint8_t *vpd_0_data, uint8_t page_code)\n     return false;\n }\n \n+int _sg_parse_vpd_80(char *err_msg, uint8_t *vpd_data, uint8_t *serial_num,\n+                     uint16_t serial_num_max_len)\n+{\n+    int rc = LSM_ERR_OK;\n+    int len = 0;\n+    struct _sg_t10_vpd80_header *vpd80_header = NULL;\n+    uint8_t *p = NULL;\n+    uint8_t *end_p = NULL;\n+    uint16_t vpd80_len = 0;\n+    uint16_t serial_num_len = 0;\n+\n+    assert(err_msg != NULL);\n+    assert(vpd_data != NULL);\n+    assert(serial_num != NULL);\n+    assert(serial_num_max_len != 0);\n+\n+    memset(serial_num, 0, serial_num_max_len);\n+\n+    vpd80_header = (struct _sg_t10_vpd80_header*) vpd_data;\n+\n+    if (vpd80_header->page_code != _SG_T10_SPC_VPD_UNIT_SN) {\n+        rc = LSM_ERR_LIB_BUG;\n+        _lsm_err_msg_set(err_msg, \"BUG: Got incorrect VPD page code '%02x', \"\n+                         \"should be 0x80\", vpd80_header->page_code);\n+        goto out;\n+    }\n+\n+    serial_num_len = be16toh(vpd80_header->page_len_be);\n+    vpd80_len = serial_num_len + sizeof(struct _sg_t10_vpd83_header);\n+\n+    end_p = vpd_data + vpd80_len - 1;\n+\n+    if (end_p >= vpd_data + _SG_T10_SPC_VPD_MAX_LEN) {\n+        rc = LSM_ERR_LIB_BUG;\n+        _lsm_err_msg_set(err_msg, \"BUG: Got invalid VPD UNIT SN page response, \"\n+                         \"data length exceeded the maximum size of a legal VPD \"\n+                         \"page\");\n+        goto out;\n+    }\n+\n+    p = vpd_data + sizeof(struct _sg_t10_vpd83_header);\n+\n+    len = snprintf(serial_num, serial_num_len, \"%s\", p);","path":"c_binding/libsg.c","position":60,"original_position":60,"commit_id":"27461a4af8103780c26b8d06c47596dc382bb214","original_commit_id":"876b2dcadb365a99ae72cf283de95e6a218f4d89","user":{"login":"cathay4t","id":934948,"avatar_url":"https://avatars.githubusercontent.com/u/934948?v=3","gravatar_id":"","url":"https://api.github.com/users/cathay4t","html_url":"https://github.com/cathay4t","followers_url":"https://api.github.com/users/cathay4t/followers","following_url":"https://api.github.com/users/cathay4t/following{/other_user}","gists_url":"https://api.github.com/users/cathay4t/gists{/gist_id}","starred_url":"https://api.github.com/users/cathay4t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathay4t/subscriptions","organizations_url":"https://api.github.com/users/cathay4t/orgs","repos_url":"https://api.github.com/users/cathay4t/repos","events_url":"https://api.github.com/users/cathay4t/events{/privacy}","received_events_url":"https://api.github.com/users/cathay4t/received_events","type":"User","site_admin":false},"body":"Compile warning, should be:\r\n\r\n`len = snprintf(serial_num, serial_num_len, \"%s\", (char *) p);`","created_at":"2016-11-14T14:52:46Z","updated_at":"2016-11-14T14:52:46Z","html_url":"https://github.com/libstorage/libstoragemgmt/pull/207#discussion_r87814796","pull_request_url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207","_links":{"self":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/comments/87814796"},"html":{"href":"https://github.com/libstorage/libstoragemgmt/pull/207#discussion_r87814796"},"pull_request":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207"}}},"pull_request":{"url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207","id":85432620,"html_url":"https://github.com/libstorage/libstoragemgmt/pull/207","diff_url":"https://github.com/libstorage/libstoragemgmt/pull/207.diff","patch_url":"https://github.com/libstorage/libstoragemgmt/pull/207.patch","issue_url":"https://api.github.com/repos/libstorage/libstoragemgmt/issues/207","number":207,"state":"open","locked":false,"title":"local_disk: Extract serial number from vpd80","user":{"login":"joehandzik","id":7061812,"avatar_url":"https://avatars.githubusercontent.com/u/7061812?v=3","gravatar_id":"","url":"https://api.github.com/users/joehandzik","html_url":"https://github.com/joehandzik","followers_url":"https://api.github.com/users/joehandzik/followers","following_url":"https://api.github.com/users/joehandzik/following{/other_user}","gists_url":"https://api.github.com/users/joehandzik/gists{/gist_id}","starred_url":"https://api.github.com/users/joehandzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joehandzik/subscriptions","organizations_url":"https://api.github.com/users/joehandzik/orgs","repos_url":"https://api.github.com/users/joehandzik/repos","events_url":"https://api.github.com/users/joehandzik/events{/privacy}","received_events_url":"https://api.github.com/users/joehandzik/received_events","type":"User","site_admin":false},"body":"Fixes issue #203\n\nSigned-off-by: Joe Handzik joseph.t.handzik@hpe.com\n","created_at":"2016-09-15T16:03:13Z","updated_at":"2016-11-14T14:52:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48f6659c765c8175abd4eb43519d404a140dcfc1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207/commits","review_comments_url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207/comments","review_comment_url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libstorage/libstoragemgmt/issues/207/comments","statuses_url":"https://api.github.com/repos/libstorage/libstoragemgmt/statuses/27461a4af8103780c26b8d06c47596dc382bb214","head":{"label":"joehandzik:wip-local-disk-serial-num","ref":"wip-local-disk-serial-num","sha":"27461a4af8103780c26b8d06c47596dc382bb214","user":{"login":"joehandzik","id":7061812,"avatar_url":"https://avatars.githubusercontent.com/u/7061812?v=3","gravatar_id":"","url":"https://api.github.com/users/joehandzik","html_url":"https://github.com/joehandzik","followers_url":"https://api.github.com/users/joehandzik/followers","following_url":"https://api.github.com/users/joehandzik/following{/other_user}","gists_url":"https://api.github.com/users/joehandzik/gists{/gist_id}","starred_url":"https://api.github.com/users/joehandzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joehandzik/subscriptions","organizations_url":"https://api.github.com/users/joehandzik/orgs","repos_url":"https://api.github.com/users/joehandzik/repos","events_url":"https://api.github.com/users/joehandzik/events{/privacy}","received_events_url":"https://api.github.com/users/joehandzik/received_events","type":"User","site_admin":false},"repo":{"id":39392893,"name":"libstoragemgmt","full_name":"joehandzik/libstoragemgmt","owner":{"login":"joehandzik","id":7061812,"avatar_url":"https://avatars.githubusercontent.com/u/7061812?v=3","gravatar_id":"","url":"https://api.github.com/users/joehandzik","html_url":"https://github.com/joehandzik","followers_url":"https://api.github.com/users/joehandzik/followers","following_url":"https://api.github.com/users/joehandzik/following{/other_user}","gists_url":"https://api.github.com/users/joehandzik/gists{/gist_id}","starred_url":"https://api.github.com/users/joehandzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joehandzik/subscriptions","organizations_url":"https://api.github.com/users/joehandzik/orgs","repos_url":"https://api.github.com/users/joehandzik/repos","events_url":"https://api.github.com/users/joehandzik/events{/privacy}","received_events_url":"https://api.github.com/users/joehandzik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joehandzik/libstoragemgmt","description":"A library for storage management","fork":true,"url":"https://api.github.com/repos/joehandzik/libstoragemgmt","forks_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/forks","keys_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/teams","hooks_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/hooks","issue_events_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/issues/events{/number}","events_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/events","assignees_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/assignees{/user}","branches_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/branches{/branch}","tags_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/tags","blobs_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/statuses/{sha}","languages_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/languages","stargazers_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/stargazers","contributors_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/contributors","subscribers_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/subscribers","subscription_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/subscription","commits_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/issues/comments{/number}","contents_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/contents/{+path}","compare_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/merges","archive_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/downloads","issues_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/issues{/number}","pulls_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/pulls{/number}","milestones_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/milestones{/number}","notifications_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/labels{/name}","releases_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/releases{/id}","deployments_url":"https://api.github.com/repos/joehandzik/libstoragemgmt/deployments","created_at":"2015-07-20T15:45:56Z","updated_at":"2016-03-28T15:43:37Z","pushed_at":"2016-11-11T19:33:36Z","git_url":"git://github.com/joehandzik/libstoragemgmt.git","ssh_url":"git@github.com:joehandzik/libstoragemgmt.git","clone_url":"https://github.com/joehandzik/libstoragemgmt.git","svn_url":"https://github.com/joehandzik/libstoragemgmt","homepage":"","size":4112,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"libstorage:master","ref":"master","sha":"c1d27292455ab530d587e78349fb7ae89f70703e","user":{"login":"libstorage","id":11510731,"avatar_url":"https://avatars.githubusercontent.com/u/11510731?v=3","gravatar_id":"","url":"https://api.github.com/users/libstorage","html_url":"https://github.com/libstorage","followers_url":"https://api.github.com/users/libstorage/followers","following_url":"https://api.github.com/users/libstorage/following{/other_user}","gists_url":"https://api.github.com/users/libstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/libstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libstorage/subscriptions","organizations_url":"https://api.github.com/users/libstorage/orgs","repos_url":"https://api.github.com/users/libstorage/repos","events_url":"https://api.github.com/users/libstorage/events{/privacy}","received_events_url":"https://api.github.com/users/libstorage/received_events","type":"Organization","site_admin":false},"repo":{"id":32356658,"name":"libstoragemgmt","full_name":"libstorage/libstoragemgmt","owner":{"login":"libstorage","id":11510731,"avatar_url":"https://avatars.githubusercontent.com/u/11510731?v=3","gravatar_id":"","url":"https://api.github.com/users/libstorage","html_url":"https://github.com/libstorage","followers_url":"https://api.github.com/users/libstorage/followers","following_url":"https://api.github.com/users/libstorage/following{/other_user}","gists_url":"https://api.github.com/users/libstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/libstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libstorage/subscriptions","organizations_url":"https://api.github.com/users/libstorage/orgs","repos_url":"https://api.github.com/users/libstorage/repos","events_url":"https://api.github.com/users/libstorage/events{/privacy}","received_events_url":"https://api.github.com/users/libstorage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libstorage/libstoragemgmt","description":"A library for storage management","fork":false,"url":"https://api.github.com/repos/libstorage/libstoragemgmt","forks_url":"https://api.github.com/repos/libstorage/libstoragemgmt/forks","keys_url":"https://api.github.com/repos/libstorage/libstoragemgmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libstorage/libstoragemgmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libstorage/libstoragemgmt/teams","hooks_url":"https://api.github.com/repos/libstorage/libstoragemgmt/hooks","issue_events_url":"https://api.github.com/repos/libstorage/libstoragemgmt/issues/events{/number}","events_url":"https://api.github.com/repos/libstorage/libstoragemgmt/events","assignees_url":"https://api.github.com/repos/libstorage/libstoragemgmt/assignees{/user}","branches_url":"https://api.github.com/repos/libstorage/libstoragemgmt/branches{/branch}","tags_url":"https://api.github.com/repos/libstorage/libstoragemgmt/tags","blobs_url":"https://api.github.com/repos/libstorage/libstoragemgmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libstorage/libstoragemgmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libstorage/libstoragemgmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/libstorage/libstoragemgmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libstorage/libstoragemgmt/statuses/{sha}","languages_url":"https://api.github.com/repos/libstorage/libstoragemgmt/languages","stargazers_url":"https://api.github.com/repos/libstorage/libstoragemgmt/stargazers","contributors_url":"https://api.github.com/repos/libstorage/libstoragemgmt/contributors","subscribers_url":"https://api.github.com/repos/libstorage/libstoragemgmt/subscribers","subscription_url":"https://api.github.com/repos/libstorage/libstoragemgmt/subscription","commits_url":"https://api.github.com/repos/libstorage/libstoragemgmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/libstorage/libstoragemgmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/libstorage/libstoragemgmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/libstorage/libstoragemgmt/issues/comments{/number}","contents_url":"https://api.github.com/repos/libstorage/libstoragemgmt/contents/{+path}","compare_url":"https://api.github.com/repos/libstorage/libstoragemgmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libstorage/libstoragemgmt/merges","archive_url":"https://api.github.com/repos/libstorage/libstoragemgmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libstorage/libstoragemgmt/downloads","issues_url":"https://api.github.com/repos/libstorage/libstoragemgmt/issues{/number}","pulls_url":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls{/number}","milestones_url":"https://api.github.com/repos/libstorage/libstoragemgmt/milestones{/number}","notifications_url":"https://api.github.com/repos/libstorage/libstoragemgmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libstorage/libstoragemgmt/labels{/name}","releases_url":"https://api.github.com/repos/libstorage/libstoragemgmt/releases{/id}","deployments_url":"https://api.github.com/repos/libstorage/libstoragemgmt/deployments","created_at":"2015-03-16T22:25:25Z","updated_at":"2016-11-06T15:52:35Z","pushed_at":"2016-11-11T19:33:36Z","git_url":"git://github.com/libstorage/libstoragemgmt.git","ssh_url":"git@github.com:libstorage/libstoragemgmt.git","clone_url":"https://github.com/libstorage/libstoragemgmt.git","svn_url":"https://github.com/libstorage/libstoragemgmt","homepage":"https://libstorage.github.io/libstoragemgmt-doc/","size":4415,"stargazers_count":24,"watchers_count":24,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":27,"forks":13,"open_issues":27,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207"},"html":{"href":"https://github.com/libstorage/libstoragemgmt/pull/207"},"issue":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/issues/207"},"comments":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/issues/207/comments"},"review_comments":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207/comments"},"review_comment":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/pulls/207/commits"},"statuses":{"href":"https://api.github.com/repos/libstorage/libstoragemgmt/statuses/27461a4af8103780c26b8d06c47596dc382bb214"}}}}
{"actor":{"display_login":"cathay4t"}}