diff mbox series

net/ipv6: warning: %u in format string (no. 2) requires 'unsigned int' but the argument type is 'signed int'.

Message ID 1609987654-11647-1-git-send-email-abaci-bugfix@linux.alibaba.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net/ipv6: warning: %u in format string (no. 2) 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 5 of 5 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 warning CHECK: Alignment should match open parenthesis
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Abaci Team Jan. 7, 2021, 2:47 a.m. UTC
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(-)

Comments

Jakub Kicinski Jan. 9, 2021, 9 p.m. UTC | #1
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.
diff mbox series

Patch

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);
 	}