hv: fix sprintf and hypercall violations

Fix the violations list below:
1.Procedure has more than one exit point.
2.Use of sizeof on an array parameter.
3.Expression needs brackets.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi
2018-12-25 11:38:32 +08:00
committed by wenlingz
parent 277c7ec8ba
commit 20d0e666ff
3 changed files with 35 additions and 38 deletions

View File

@@ -86,7 +86,7 @@ static const char *get_param(const char *s_arg, uint32_t *x)
/* parse uint32_teger */
while ((*s >= '0') && (*s <= '9')) {
char delta = *s - '0';
*x = *x * 10U + (uint32_t)delta;
*x = ((*x) * 10U) + (uint32_t)delta;
s++;
}
@@ -97,7 +97,7 @@ static const char *get_flags(const char *s_arg, uint32_t *flags)
{
const char *s = s_arg;
/* contains the flag characters */
static const char flagchars[] = "#0- +";
static const char flagchars[5] = "#0- +";
/* contains the numeric flags for the characters above */
static const uint32_t fl[sizeof(flagchars)] = {
PRINT_FLAG_ALTERNATE_FORM, /* # */