Re: [PATCH] liquidio: fix: warning: %u in format string (no. 3) requires 'unsigned int' but the argument type is 'signed int'.

From: Joe Perches
Date: Wed Dec 30 2020 - 01:50:37 EST


On Wed, 2020-12-30 at 14:41 +0800, YANG LI wrote:
> For safety, modify '%u' to '%d' to keep the type consistent.

There is no additional safety here.

The for loop ensures that i is positive as num_ioq_vector is also
int and so i can not be negative as it's incremented from 0.

> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
[]
> @@ -1109,12 +1109,12 @@ int octeon_setup_interrupt(struct octeon_device *oct, u32 num_ioqs)
>   for (i = 0 ; i < num_ioq_vectors ; i++) {
>   if (OCTEON_CN23XX_PF(oct))
>   snprintf(&queue_irq_names[IRQ_NAME_OFF(i)],
> - INTRNAMSIZ, "LiquidIO%u-pf%u-rxtx-%u",
> + INTRNAMSIZ, "LiquidIO%u-pf%u-rxtx-%d",
>   oct->octeon_id, oct->pf_num, i);
>  
>
>   if (OCTEON_CN23XX_VF(oct))
>   snprintf(&queue_irq_names[IRQ_NAME_OFF(i)],
> - INTRNAMSIZ, "LiquidIO%u-vf%u-rxtx-%u",
> + INTRNAMSIZ, "LiquidIO%u-vf%u-rxtx-%d",
>   oct->octeon_id, oct->vf_num, i);
>  
>
>   irqret = request_irq(msix_entries[i].vector,