hv: fix integer violations

fix the following integer violations:
1. Signed/unsigned conversion without cast
2. Literal value requires a U suffix
3. Implicit conversion of underlying type

v3 -> v4:
 * change the type of npk_loglevel/mem_loglevel/console_loglevel
   from uint32_t to uint16_t

v2 -> v3:
 * discard the return value of update_ept
 * discard changes related to npk loglevel

v1 -> v2:
 * remove the unnecessary changes related to the false positive
   issues caused by scanning tool
 * change the type of the local variable 'vlapic_id' from uint8_t
   to uint32_t in function 'vlapic_build_id'
 * change the type of the struct member 'flags' in shared_buf from
   uint64_t to uint32_t

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shiqing Gao
2018-11-09 11:39:18 +08:00
committed by wenlingz
parent 7e6d0a2176
commit d97224a4b5
17 changed files with 68 additions and 72 deletions

View File

@@ -28,9 +28,9 @@
#if defined(HV_DEBUG)
extern uint32_t console_loglevel;
extern uint32_t mem_loglevel;
extern uint32_t npk_loglevel;
extern uint16_t console_loglevel;
extern uint16_t mem_loglevel;
extern uint16_t npk_loglevel;
void init_logmsg(uint32_t flags);
void print_logmsg_buffer(uint16_t pcpu_id);
void do_logmsg(uint32_t severity, const char *fmt, ...);

View File

@@ -13,7 +13,7 @@
#define HV_NPK_LOG_HDR 0x01000242U
enum {
HV_NPK_LOG_CMD_INVALID,
HV_NPK_LOG_CMD_INVALID = 0U,
HV_NPK_LOG_CMD_CONF,
HV_NPK_LOG_CMD_ENABLE,
HV_NPK_LOG_CMD_DISABLE,

View File

@@ -37,7 +37,7 @@
*/
enum {
ACRN_TRACE,
ACRN_TRACE = 0U,
ACRN_HVLOG,
ACRN_SEP,
ACRN_SOCWATCH,
@@ -51,7 +51,8 @@ struct shared_buf {
uint32_t ele_size; /* sizeof of elements */
uint32_t head; /* offset from base, to read */
uint32_t tail; /* offset from base, to write */
uint64_t flags;
uint32_t flags;
uint32_t reserved;
uint32_t overrun_cnt; /* count of overrun */
uint32_t size; /* ele_num * ele_size */
uint32_t padding[6];
@@ -59,17 +60,17 @@ struct shared_buf {
#ifdef HV_DEBUG
static inline void sbuf_clear_flags(struct shared_buf *sbuf, uint64_t flags)
static inline void sbuf_clear_flags(struct shared_buf *sbuf, uint32_t flags)
{
sbuf->flags &= ~flags;
}
static inline void sbuf_set_flags(struct shared_buf *sbuf, uint64_t flags)
static inline void sbuf_set_flags(struct shared_buf *sbuf, uint32_t flags)
{
sbuf->flags = flags;
}
static inline void sbuf_add_flags(struct shared_buf *sbuf, uint64_t flags)
static inline void sbuf_add_flags(struct shared_buf *sbuf, uint32_t flags)
{
sbuf->flags |= flags;
}
@@ -91,19 +92,19 @@ uint32_t sbuf_next_ptr(uint32_t pos, uint32_t span, uint32_t scope);
static inline void sbuf_clear_flags(
__unused struct shared_buf *sbuf,
__unused uint64_t flags)
__unused uint32_t flags)
{
}
static inline void sbuf_set_flags(
__unused struct shared_buf *sbuf,
__unused uint64_t flags)
__unused uint32_t flags)
{
}
static inline void sbuf_add_flags(
__unused struct shared_buf *sbuf,
__unused uint64_t flags)
__unused uint32_t flags)
{
}