log: Explicitly ignoring return of memcpy

According with MISRA-C the value returned by a non-void function has
to be used. As memcpy return is almost useless, we are explicitly
ignoring it.

MISRA-C rule 17.7

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2018-12-17 19:08:03 -08:00 committed by Carles Cufí
parent b467de5849
commit 27435e4cb3
4 changed files with 17 additions and 13 deletions

View file

@ -126,7 +126,7 @@ static int do_net_init(void)
}
if (IS_ENABLED(CONFIG_NET_HOSTNAME_ENABLE)) {
memcpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);
(void)memcpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);
} else if (IS_ENABLED(CONFIG_NET_IPV6) &&
server_addr.sa_family == AF_INET6) {

View file

@ -105,7 +105,7 @@ static int log_backend_rtt_write_drop(void)
if (drop_cnt > 0 && !drop_warn) {
memmove(line_buf + DROP_MSG_LEN, line_buf,
line_pos - line_buf);
memcpy(line_buf, drop_msg, DROP_MSG_LEN);
(void)memcpy(line_buf, drop_msg, DROP_MSG_LEN);
line_pos += DROP_MSG_LEN;
drop_warn = 1;
}

View file

@ -184,19 +184,21 @@ static void copy_args_to_msg(struct log_msg *msg, u32_t *args, u32_t nargs)
struct log_msg_cont *cont = msg->payload.ext.next;
if (nargs > LOG_MSG_NARGS_SINGLE_CHUNK) {
memcpy(msg->payload.ext.data.args, args,
(void)memcpy(msg->payload.ext.data.args, args,
LOG_MSG_NARGS_HEAD_CHUNK * sizeof(u32_t));
nargs -= LOG_MSG_NARGS_HEAD_CHUNK;
args += LOG_MSG_NARGS_HEAD_CHUNK;
} else {
memcpy(msg->payload.single.args, args, nargs * sizeof(u32_t));
(void)memcpy(msg->payload.single.args, args,
nargs * sizeof(u32_t));
nargs = 0U;
}
while (nargs) {
u32_t cpy_args = min(nargs, ARGS_CONT_MSG);
memcpy(cont->payload.args, args, cpy_args * sizeof(u32_t));
(void)memcpy(cont->payload.args, args,
cpy_args * sizeof(u32_t));
nargs -= cpy_args;
args += cpy_args;
cont = cont->next;
@ -247,7 +249,7 @@ struct log_msg *log_msg_hexdump_create(const char *str,
if (length > LOG_MSG_HEXDUMP_BYTES_SINGLE_CHUNK) {
memcpy(msg->payload.ext.data.bytes,
(void)memcpy(msg->payload.ext.data.bytes,
data,
LOG_MSG_HEXDUMP_BYTES_HEAD_CHUNK);
msg->payload.ext.next = NULL;
@ -256,7 +258,7 @@ struct log_msg *log_msg_hexdump_create(const char *str,
data += LOG_MSG_HEXDUMP_BYTES_HEAD_CHUNK;
length -= LOG_MSG_HEXDUMP_BYTES_HEAD_CHUNK;
} else {
memcpy(msg->payload.single.bytes, data, length);
(void)memcpy(msg->payload.single.bytes, data, length);
msg->hdr.params.generic.ext = 0;
length = 0U;
}
@ -277,7 +279,7 @@ struct log_msg *log_msg_hexdump_create(const char *str,
chunk_length = (length > HEXDUMP_BYTES_CONT_MSG) ?
HEXDUMP_BYTES_CONT_MSG : length;
memcpy(cont->payload.bytes, data, chunk_length);
(void)memcpy(cont->payload.bytes, data, chunk_length);
data += chunk_length;
length -= chunk_length;
}
@ -323,9 +325,9 @@ static void log_msg_hexdump_data_op(struct log_msg *msg,
cpy_len = req_len > chunk_len ? chunk_len : req_len;
if (put_op) {
memcpy(&head_data[offset], data, cpy_len);
(void)memcpy(&head_data[offset], data, cpy_len);
} else {
memcpy(data, &head_data[offset], cpy_len);
(void)memcpy(data, &head_data[offset], cpy_len);
}
req_len -= cpy_len;
@ -348,9 +350,11 @@ static void log_msg_hexdump_data_op(struct log_msg *msg,
cpy_len = req_len > chunk_len ? chunk_len : req_len;
if (put_op) {
memcpy(&cont->payload.bytes[offset], data, cpy_len);
(void)memcpy(&cont->payload.bytes[offset],
data, cpy_len);
} else {
memcpy(data, &cont->payload.bytes[offset], cpy_len);
(void)memcpy(data, &cont->payload.bytes[offset],
cpy_len);
}
offset = 0;

View file

@ -169,7 +169,7 @@ void syslog_net_hook_install(void)
}
#if CONFIG_NET_HOSTNAME_ENABLE
memcpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);
(void)memcpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);
#else /* CONFIG_NET_HOSTNAME_ENABLE */
if (server_addr.sa_family == AF_INET6) {
#if defined(CONFIG_NET_IPV6)