From cf6af41b293fb4526041d14227a051a8bd6a53ea Mon Sep 17 00:00:00 2001 From: Roy Pledge Date: Thu, 4 Jun 2015 14:18:03 -0400 Subject: fsl_usdpaa: Ensure map name is initialized and cleared Make sure that map name is null terminated when a memory map is split and is cleared when a map is destroyed Signed-off-by: Roy Pledge Change-Id: If779b54817b9c2d49d6e18106b333a51ca2b2dcf Reviewed-on: http://git.am.freescale.net:8181/37436 Tested-by: Review Code-CDREVIEW Reviewed-by: Honghua Yin diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c index 0549bae..55223cd 100644 --- a/drivers/staging/fsl_qbman/fsl_usdpaa.c +++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c @@ -230,6 +230,7 @@ static struct mem_fragment *split_frag(struct mem_fragment *frag) x[0]->refs = x[1]->refs = x[2]->refs = 0; x[0]->root_len = x[1]->root_len = x[2]->root_len = frag->root_len; x[0]->root_pfn = x[1]->root_pfn = x[2]->root_pfn = frag->root_pfn; + x[0]->name[0] = x[1]->name[0] = x[2]->name[0] = 0; list_add_tail(&x[0]->list, &frag->list); list_add_tail(&x[1]->list, &x[0]->list); list_add_tail(&x[2]->list, &x[1]->list); @@ -241,9 +242,10 @@ static __maybe_unused void dump_frags(void) struct mem_fragment *frag; int i = 0; list_for_each_entry(frag, &mem_list, list) { - pr_info("FRAG %d: base 0x%llx pfn_base 0x%lx len 0x%llx root_len 0x%llx root_pfn 0x%lx refs %d\n", + pr_info("FRAG %d: base 0x%llx pfn_base 0x%lx len 0x%llx root_len 0x%llx root_pfn 0x%lx refs %d name %s\n", i, frag->base, frag->pfn_base, - frag->len, frag->root_len, frag->root_pfn, frag->refs); + frag->len, frag->root_len, frag->root_pfn, + frag->refs, frag->name); ++i; } } @@ -1154,6 +1156,7 @@ map_match: current_frag = list_entry(current_frag->list.prev, struct mem_fragment, list); } + map->root_frag->name[0] = 0; list_del(&map->list); compress_frags(); spin_unlock(&mem_lock); -- cgit v0.10.2