Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/ocp/ocp-nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#if !defined(OCP_NVME) || defined(CMD_HEADER_MULTI_READ)
#define OCP_NVME

#define OCP_PLUGIN_VERSION "2.11.0"
#define OCP_PLUGIN_VERSION "2.12.0"
#include "cmd.h"

PLUGIN(NAME("ocp", "OCP cloud SSD extensions", OCP_PLUGIN_VERSION),
Expand Down
6 changes: 5 additions & 1 deletion plugins/ocp/ocp-telemetry-decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,19 @@ void json_add_formatted_u32_str(struct json_object *pobject, const char *msg, un
void json_add_formatted_var_size_str(struct json_object *pobject, const char *msg, __u8 *pdata,
unsigned int data_size)
{
char description_str[256] = "";
char *description_str = NULL;
char temp_buffer[3] = { 0 };

/* Allocate 2 chars for each value in the data + 2 bytes for the null terminator */
description_str = (char *) calloc(1, data_size*2 + 2);

for (size_t i = 0; i < data_size; ++i) {
sprintf(temp_buffer, "%02X", pdata[i]);
strcat(description_str, temp_buffer);
}

json_object_add_value_string(pobject, msg, description_str);
free(description_str);
}
#endif /* CONFIG_JSONC */

Expand Down
6 changes: 5 additions & 1 deletion util/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ unsigned char *read_binary_file(char *data_dir_path, const char *bin_path,

void print_formatted_var_size_str(const char *msg, const __u8 *pdata, size_t data_size, FILE *fp)
{
char description_str[1024] = "";
char *description_str = NULL;
char temp_buffer[3] = { 0 };

/* Allocate 2 chars for each value in the data + 2 bytes for the null terminator */
description_str = (char *) calloc(1, data_size*2 + 2);

for (size_t i = 0; i < data_size; ++i) {
sprintf(temp_buffer, "%02X", pdata[i]);
strcat(description_str, temp_buffer);
Expand All @@ -150,6 +153,7 @@ void print_formatted_var_size_str(const char *msg, const __u8 *pdata, size_t dat
fp = stdout;

fprintf(fp, "%s: %s\n", msg, description_str);
free(description_str);
}

void process_field_size_16(int offset, char *sfield, __u8 *buf, char *datastr)
Expand Down