diff mbox series

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

Message ID 1609310480-80777-1-git-send-email-abaci-bugfix@linux.alibaba.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series liquidio: fix: warning: %u in format string (no. 3) requires 'unsigned int' but the argument type is 'signed int'. | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 12 this patch: 12
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Abaci Team Dec. 30, 2020, 6:41 a.m. UTC
For safety, modify '%u' to '%d' to keep the type consistent.

Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Joe Perches Dec. 30, 2020, 6:49 a.m. UTC | #1
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,
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
index 37d0641..07846f9 100644
--- 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,