From 62c13898255fea1a303d7beef40fb5202d6c952c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 12 Apr 2020 09:52:56 -0600 Subject: [PATCH] Fix warnings noted in PR build checks: net/telnet.c:1317:40: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare] if (priv->td_pending < CONFIG_TELNET_RXBUFFER_SIZE) ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ time/lib_localtime.c:569:32: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [33]' [-Wsizeof-array-decay] sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name)) ~~~~~~~~~~~~~ ^ --- drivers/net/telnet.c | 2 +- libs/libc/time/lib_localtime.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 5346065aea..493e9587f3 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -144,10 +144,10 @@ struct telnet_dev_s sem_t td_exclsem; /* Enforces mutually exclusive access */ sem_t td_iosem; /* I/O thread will notify that data is available */ uint8_t td_state; /* (See telnet_state_e) */ - uint8_t td_pending; /* Number of valid, pending bytes in the rxbuffer */ uint8_t td_offset; /* Offset to the valid, pending bytes in the rxbuffer */ uint8_t td_crefs; /* The number of open references to the session */ uint8_t td_minor; /* Minor device number */ + uint16_t td_pending; /* Number of valid, pending bytes in the rxbuffer */ #ifdef CONFIG_TELNET_SUPPORT_NAWS uint16_t td_rows; /* Number of NAWS rows */ uint16_t td_cols; /* Number of NAWS cols */ diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c index e18b3b5723..e2c411ab5e 100644 --- a/libs/libc/time/lib_localtime.c +++ b/libs/libc/time/lib_localtime.c @@ -566,7 +566,7 @@ static int tzload(FAR const char *name, { p = TZDIR; if (p == NULL || - sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name)) + FILENAME_MAX <= strlen(p) + strlen(name)) { goto oops; }