Skip to contentSkip to conversation

staging: lustre: lnet: memory corruption in selftest

PATCH In review Dan Carpenter 2 participants 2 messages Nov 24, 2016 – Nov 26, 2016

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

PATCH 1/1 staging: lustre: lnet: memory corruption in selftest

We want sizeof(struct lstcon_node) but instead we're getting the sizeof a pointer.

Fixes 8d78f0f2ba76 ("staging: lustre: lnet: cleanup some of the > 80 line issues")
drivers/staging/lustre/lnet/selftest/console.c +1 -1
index f2d11fa..f750b9c 100644
@@ -86,7 +86,7 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create)
 	if (!create)
 		return -ENOENT;
 
-	LIBCFS_ALLOC(*ndpp, sizeof(*ndpp) + sizeof(*ndl));
+	LIBCFS_ALLOC(*ndpp, sizeof(**ndpp) + sizeof(*ndl));
 	if (!*ndpp)
 		return -ENOMEM;
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

We want sizeof(struct lstcon_node) but instead we're getting the sizeof a pointer.

Fixes 8d78f0f2ba76 ("staging: lustre: lnet: cleanup some of the > 80 line issues")
Quoted 14 lines
drivers/staging/lustre/lnet/selftest/console.c +1 -1
index f2d11fa..f750b9c 100644
@@ -86,7 +86,7 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create)
 	if (!create)
 		return -ENOENT;
 
-	LIBCFS_ALLOC(*ndpp, sizeof(*ndpp) + sizeof(*ndl));
+	LIBCFS_ALLOC(*ndpp, sizeof(**ndpp) + sizeof(*ndl));
 	if (!*ndpp)
 		return -ENOMEM;