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. Since p1 > p0, cast the ptrdiff to uint.
Signed-off-by: Andrea Bastoni <[email protected]> --- hypervisor/printk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hypervisor/printk.c b/hypervisor/printk.c index c9e22b29..1b3027ba 100644 --- a/hypervisor/printk.c +++ b/hypervisor/printk.c @@ -133,11 +133,12 @@ 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) + /* Note: p1 > p0 here */ + if ((unsigned int)(p1 - p0) >= width) return p1; for (n = 1; p1 - n >= p0; n++) -- 2.28.0 -- 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/20201028210933.138379-6-andrea.bastoni%40tum.de.
