[net] proc: snmp6: Use correct type in memset

Submitted by Christian Perle on June 12, 2017, 8:06 a.m.

Details

Message ID 20170612080657.GB1536@cell
State Accepted
Delegated to: David Miller
Headers show

Commit Message

Christian Perle June 12, 2017, 8:06 a.m.
Reading /proc/net/snmp6 yields bogus values on 32 bit kernels.
Use "u64" instead of "unsigned long" in sizeof().

Fixes: 4a4857b ("proc: Reduce cache miss in snmp6_seq_show")
Signed-off-by: Christian Perle <christian.perle@secunet.com>
---
 net/ipv6/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller June 12, 2017, 1:53 p.m.
From: Christian Perle <christian.perle@secunet.com>
Date: Mon, 12 Jun 2017 10:06:57 +0200

> Reading /proc/net/snmp6 yields bogus values on 32 bit kernels.
> Use "u64" instead of "unsigned long" in sizeof().
> 
> Fixes: 4a4857b ("proc: Reduce cache miss in snmp6_seq_show")

Please use 12 significant digits of SHA1-ID in Fixes: tags, I fixed
it up for you this time.

> Signed-off-by: Christian Perle <christian.perle@secunet.com>

Applied and queued up for -stable, thanks.

Patch hide | download patch | download mbox

diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index cc8e3ae..e88bcb8 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -219,7 +219,7 @@  static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib,
 	u64 buff64[SNMP_MIB_MAX];
 	int i;
 
-	memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX);
+	memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX);
 
 	snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff);
 	for (i = 0; itemlist[i].name; i++)