Repository navigation
DAOS-6685 Test: Fixed coverity issue in test code. - #4583
Conversation
daosbuild1
left a comment
There was a problem hiding this comment.
Style warning(s) for job https://build.hpdd.intel.com/job/daos-stack/job/daos/job/PR-4583/1/
Please review https://wiki.hpdd.intel.com/display/DC/Coding+Rules
|
Test stage checkpatch completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-4583/1/execution/node/68/log |
c4d356b to
84f0be2
Compare
daosbuild1
left a comment
There was a problem hiding this comment.
Style warning(s) for job https://build.hpdd.intel.com/job/daos-stack/job/daos/job/PR-4583/2/
Please review https://wiki.hpdd.intel.com/display/DC/Coding+Rules
|
Test stage checkpatch completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-4583/2/execution/node/69/log |
Signed-off-by: Samir Raval <samir.raval@intel.com> Test-tag-hw-medium: nvme,unittest Signed-off-by: Samir Raval <samir.raval@intel.com>
84f0be2 to
3308825
Compare
daosbuild1
left a comment
There was a problem hiding this comment.
LGTM. No errors found by checkpatch.
|
NVMe recovery test failure is because of DAOS-6764 and DAOS-6717 |
| dev = json_object_array_get_idx(smd_dev, i); | ||
| strcpy(devices[*disks].host, strtok(host, ":") + 1); | ||
|
|
||
| if (strlen(host + 2) <= DSS_HOSTNAME_MAX_LEN) |
There was a problem hiding this comment.
Does (host+2) instead of (host) points to the real host name?
devices[*disks].host is an 50bytes array:
typedef struct {
uuid_t device_id;
char state[10];
int rank;
char host[50];
int tgtidx[MAX_TEST_TARGETS_PER_DEVICE];
int n_tgtidx;
} device_list;
and
#define DSS_HOSTNAME_MAX_LEN 255
Won't there still a risk of Copy into fixed size buffer (STRING_OVERFLOW)?
There was a problem hiding this comment.
host[50] has been changed to host[DSS_HOSTNAME_MAX_LEN]. Please see the changes below..
typedef struct {
uuid_t device_id;
char state[10];
int rank;
char host[DSS_HOSTNAME_MAX_LEN];
int tgtidx[MAX_TEST_TARGETS_PER_DEVICE];
int n_tgtidx;
} device_list;
|
https://scan8.coverity.com/reports.htm#v42469/p12225/fileInstanceId=39449665&defectInstanceId=11402595&mergedDefectId=313074 |
Yes, I miss the one which was added later. let me update the current PR |
Signed-off-by: Samir Raval <samir.raval@intel.com>
daosbuild1
left a comment
There was a problem hiding this comment.
LGTM. No errors found by checkpatch.
| if (!json_object_object_get_ex(val, "storage", &storage_info)) { | ||
| D_ERROR("unable to extract hosts from JSON\n"); | ||
| return -DER_INVAL; | ||
| D_GOTO(out, rc = -DER_INVAL); |
There was a problem hiding this comment.
Shouldn't goto out_json in order to execute cmd_free_args(args, argcount);?
Also, the json_object_object_get_ex() call before the loop (_foreach) needs D_GOTO as well I think. So total 3 places.
There was a problem hiding this comment.
Yes, the intention was to add out_json. Thanks for catching it
There was a problem hiding this comment.
What about the if statement in line #791-#794? I think the cid pointed out this case as #1 of 2 case:
775 if (!json_object_object_get_ex(dmg_out, "host_storage_map",
776 &storage_map)) {
777 D_ERROR("unable to extract host_storage_map from JSON\n");
CID 313074 (#1 of 2): Resource leak (RESOURCE_LEAK) [select issue]
778 return -DER_INVAL;
779 }
780
781 json_object_object_foreach(storage_map, key, val) {
There was a problem hiding this comment.
Is this new I do not see it in defect DAOS-6685?
There was a problem hiding this comment.
It's in https://scan8.coverity.com/reports.htm#v42469/p12225/fileInstanceId=39449665&defectInstanceId=11402595&mergedDefectId=313074
There are two occurrences for this issue, #1 of 2 and #2 of 2, It seems #1 of 2 I copied above maybe also need to make the same change.
There was a problem hiding this comment.
Both occurrences have been fixed.
Test-tag-hw-medium: nvme,unittest
daosbuild1
left a comment
There was a problem hiding this comment.
LGTM. No errors found by checkpatch.
Test-tag-hw-medium: nvme,unittest
daosbuild1
left a comment
There was a problem hiding this comment.
LGTM. No errors found by checkpatch.
Test-tag-hw-medium: nvme,unittest Signed-off-by: Samir Raval <samir.raval@intel.com>
daosbuild1
left a comment
There was a problem hiding this comment.
LGTM. No errors found by checkpatch.
daosbuild1
left a comment
There was a problem hiding this comment.
LGTM. No errors found by checkpatch.
Signed-off-by: Samir Raval samir.raval@intel.com
Test-tag-hw-medium: nvme,unittest