logging: improve string logging on 64-bit ABI
In std_print(), the log arguments were casted to uint32_t before being sent further to the output function. For integer types which can not be represented by uint32_t, the degraded user experience may be acceptable. However, for string arguments, the output function will eventually dereference the pointer, so if the "char *" can not be represented by uint32_t, bad things are going to happen. In practice you will see this on 64-bit systems where sizeof (char *) is 8 byte and addresses higher than 0x80000000. Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
parent
9d1dd9a760
commit
dc4e331e45
1 changed files with 1 additions and 1 deletions
|
@ -280,7 +280,7 @@ static void std_print(struct log_msg *msg,
|
|||
{
|
||||
const char *str = log_msg_str_get(msg);
|
||||
uint32_t nargs = log_msg_nargs_get(msg);
|
||||
uint32_t *args = alloca(sizeof(uint32_t)*nargs);
|
||||
log_arg_t *args = alloca(sizeof(log_arg_t)*nargs);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nargs; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue