Skip to contentSkip to conversation

: Use kmemdup in cipso_ipv4.c

PATCH In review Arnaldo Carvalho de Melo 2 participants 2 messages Nov 17, 2006

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

PATCH 3/10 : Use kmemdup in cipso_ipv4.c

Code diff stats:

[acme@newtoy net-2.6.20]$ codiff /tmp/cipso_ipv4.o.before /tmp/cipso_ipv4.o.after /pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/cipso_ipv4.c:
cipso_v4_cache_add | -46
1 function changed, 46 bytes removed
[acme@newtoy net-2.6.20]$

---
 net/ipv4/cipso_ipv4.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
net/ipv4/cipso_ipv4.c +1 -2
index c3a61eb..095038a 100644
@@ -377,12 +377,11 @@ int cipso_v4_cache_add(const struct sk_b
 	entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
 	if (entry == NULL)
 		return -ENOMEM;
-	entry->key = kmalloc(cipso_ptr_len, GFP_ATOMIC);
+	entry->key = kmemdup(cipso_ptr, cipso_ptr_len, GFP_ATOMIC);
 	if (entry->key == NULL) {
 		ret_val = -ENOMEM;
 		goto cache_add_failure;
 	}
-	memcpy(entry->key, cipso_ptr, cipso_ptr_len);
 	entry->key_len = cipso_ptr_len;
 	entry->hash = cipso_v4_map_cache_hash(cipso_ptr, cipso_ptr_len);
 	atomic_inc(&secattr->cache->refcount);
Signature · 1 line
1.4.2.1.g3d5c
Acked-by on v1 3/10
#1 lore raw
Quoted 9 lines · Arnaldo Carvalho de Melo

Code diff stats:

[acme@newtoy net-2.6.20]$ codiff /tmp/cipso_ipv4.o.before /tmp/cipso_ipv4.o.after /pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/cipso_ipv4.c:
cipso_v4_cache_add | -46
1 function changed, 46 bytes removed
[acme@newtoy net-2.6.20]$

Looks fine to me.

Signature · 2 lines
paul moore
linux security @ hp