{
struct pass_resource_info *info;
int i, ret;
+ int len;
for (i = 0; i < pass->num_resources; i++) {
struct pass_resource *pass_res = &pass->res[i];
switch (res_type) {
case PASS_RESOURCE_CPU_ID:
- strncpy(name, PASS_RESOURCE_CPU_NAME,
- strlen(PASS_RESOURCE_CPU_NAME));
+ len = strlen(PASS_RESOURCE_CPU_NAME);
+ strncpy(name, PASS_RESOURCE_CPU_NAME, len);
break;
case PASS_RESOURCE_BUS_ID:
- strncpy(name, PASS_RESOURCE_BUS_NAME,
- strlen(PASS_RESOURCE_BUS_NAME));
+ len = strlen(PASS_RESOURCE_BUS_NAME);
+ strncpy(name, PASS_RESOURCE_BUS_NAME, len);
break;
case PASS_RESOURCE_GPU_ID:
- strncpy(name, PASS_RESOURCE_GPU_NAME,
- strlen(PASS_RESOURCE_GPU_NAME));
+ len = strlen(PASS_RESOURCE_GPU_NAME);
+ strncpy(name, PASS_RESOURCE_GPU_NAME, len);
break;
default:
_E("Unsupported resource type (type: %d)\n", res_type);
return -EINVAL;
};
+ name[len] = '\0';
+
ret = pass_get_hw_info(name,
(const struct pass_resource_info **)&info);
if (ret < 0) {