linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/ipv6: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'.
@ 2021-01-07  2:47 Jiapeng Zhong
  2021-01-09 21:00 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Zhong @ 2021-01-07  2:47 UTC (permalink / raw)
  To: davem; +Cc: kuznet, yoshfuji, kuba, netdev, linux-kernel, Jiapeng Zhong

The print format of this parameter does not match, because it is defined
as int type, so modify the matching format of this parameter to %d format.

Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
---
 net/ipv6/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index d6306aa..26c702b 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -169,7 +169,7 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, atomic_long_t *smib)
 		val = atomic_long_read(smib + i);
 		if (!val)
 			continue;
-		snprintf(name, sizeof(name), "Icmp6%sType%u",
+		snprintf(name, sizeof(name), "Icmp6%sType%d",
 			i & 0x100 ?  "Out" : "In", i & 0xff);
 		seq_printf(seq, "%-32s\t%lu\n", name, val);
 	}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/ipv6: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'.
  2021-01-07  2:47 [PATCH] net/ipv6: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int' Jiapeng Zhong
@ 2021-01-09 21:00 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-01-09 21:00 UTC (permalink / raw)
  To: Jiapeng Zhong; +Cc: davem, kuznet, yoshfuji, netdev, linux-kernel

On Thu,  7 Jan 2021 10:47:34 +0800 Jiapeng Zhong wrote:
> The print format of this parameter does not match, because it is defined
> as int type, so modify the matching format of this parameter to %d format.
> 
> Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
> Reported-by: Abaci <abaci@linux.alibaba.com>
> ---
>  net/ipv6/proc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
> index d6306aa..26c702b 100644
> --- a/net/ipv6/proc.c
> +++ b/net/ipv6/proc.c
> @@ -169,7 +169,7 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, atomic_long_t *smib)
>  		val = atomic_long_read(smib + i);
>  		if (!val)
>  			continue;
> -		snprintf(name, sizeof(name), "Icmp6%sType%u",
> +		snprintf(name, sizeof(name), "Icmp6%sType%d",
>  			i & 0x100 ?  "Out" : "In", i & 0xff);
>  		seq_printf(seq, "%-32s\t%lu\n", name, val);
>  	}

Type can't be negative, there is no reason for @i to be signed.
Changing type of @i sounds like a better idea.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-09 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07  2:47 [PATCH] net/ipv6: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int' Jiapeng Zhong
2021-01-09 21:00 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).