On 22.10.20 19:58, Andrea Bastoni wrote:
> Cast width to int. This is complicated to fix without a cast. A possible
> alternative is to cast the char* to an unsigned long "address" type, but
> that is even less intuitive.
> 
> Signed-off-by: Andrea Bastoni <[email protected]>
> ---
>  hypervisor/printk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hypervisor/printk.c b/hypervisor/printk.c
> index c9e22b29..a32ff8c4 100644
> --- a/hypervisor/printk.c
> +++ b/hypervisor/printk.c
> @@ -133,11 +133,11 @@ static char *hex2str(unsigned long long value, char 
> *buf,
>       return buf;
>  }
>  
> -static char *align(char *p1, char *p0, unsigned long width, char fill)
> +static char *align(char *p1, char *p0, unsigned int width, char fill)
>  {
>       unsigned int n;
>  
> -     if (p1 - p0 >= width)
> +     if ((p1 - p0) >= (int)width)

p1 is always > p0, so I think it would be more logical to cast the diff
to unsigned int (along with a comment, maybe).

>               return p1;
>  
>       for (n = 1; p1 - n >= p0; n++)
> 

You should also fix up the inmate/lib.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/22f10480-64ae-8aca-ed7c-115a1e376ed1%40siemens.com.

Reply via email to