Skip to contentSkip to conversation

s390: use kcalloc instead of kmalloc and memset

PATCH Applied Stelian Nirlu 2 participants 2 messages Mar 11, 2013 – Mar 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 s390: use kcalloc instead of kmalloc and memset

---
 arch/s390/net/bpf_jit_comp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +1 -2
index 0972e91..82f165f 100644
@@ -747,10 +747,9 @@ void bpf_jit_compile(struct sk_filter *fp)
 
 	if (!bpf_jit_enable)
 		return;
-	addrs = kmalloc(fp->len * sizeof(*addrs), GFP_KERNEL);
+	addrs = kcalloc(fp->len, sizeof(*addrs), GFP_KERNEL);
 	if (addrs == NULL)
 		return;
-	memset(addrs, 0, fp->len * sizeof(*addrs));
 	memset(&jit, 0, sizeof(cjit));
 	memset(&cjit, 0, sizeof(cjit));
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 10 lines · Stelian Nirlu
---
 arch/s390/net/bpf_jit_comp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +0 -0
index 0972e91..82f165f 100644

arch/s390/net/bpf_jit_comp.c void bpf_jit_compile(struct sk_filter *fp) · line 753

Quoted 8 lines
arch/s390/net/bpf_jit_comp.c +1 -2
@@ -747,10 +747,9 @@ void bpf_jit_compile(struct sk_filter *fp)
 
 	if (!bpf_jit_enable)
 		return;
-	addrs = kmalloc(fp->len * sizeof(*addrs), GFP_KERNEL);
+	addrs = kcalloc(fp->len, sizeof(*addrs), GFP_KERNEL);
 	if (addrs == NULL)
 		return;
-	memset(addrs, 0, fp->len * sizeof(*addrs));

Applied, thanks!