[PATCH] smatch_allocations: Give a hint about dma_alloc_(attrs|coherent)

Christophe JAILLET <[email protected]> Mon, 15 Aug 2022 10:18:31 +0200
Newsgroups org.kernel.vger.smatch
Message-ID <c8d97ff256eee5ad0bf1acbd06d9d94fa16771dc.1660551505.git.christophe.jaillet@wanadoo.fr>
In recent kernel, dma_alloc_attrs() and dma_alloc_coherent() zero the
allocated memory.

Signed-off-by: Christophe JAILLET <[email protected]>
---
This was not the case in older kernel, so maybe it is better not to state
that the memory is zeroed.

(I've not seen where/how this .zeroed information was used)
---
 smatch_allocations.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/smatch_allocations.c b/smatch_allocations.c
index ae6182178405..111c4e9bd82d 100644
--- a/smatch_allocations.c
+++ b/smatch_allocations.c
@@ -48,8 +48,8 @@ static struct alloc_fn_info kernel_alloc_funcs[] = {
 	{"devm_kmalloc_array", "$1 * $2"},
 	{"devm_kcalloc", "$1 * $2", .zeroed=true},
 
-	{"dma_alloc_attrs", "$1"},
-	{"dma_alloc_coherent", "$1"},
+	{"dma_alloc_attrs", "$1", .zeroed=true},
+	{"dma_alloc_coherent", "$1", .zeroed=true},
 	{"dma_alloc_consistent", "$1"},
 	{"dma_alloc_contiguous", "$1"},
 
-- 
2.34.1