Smatch (Semantic Matching Tool) development
 help / color / mirror / Atom feed
* [PATCH] smatch_allocations: Give a hint about dma_alloc_(attrs|coherent)
@ 2022-08-15  8:18 Christophe JAILLET
  2022-08-15 11:42 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-08-15  8:18 UTC (permalink / raw)
  To: smatch; +Cc: Christophe JAILLET

In recent kernel, dma_alloc_attrs() and dma_alloc_coherent() zero the
allocated memory.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] smatch_allocations: Give a hint about dma_alloc_(attrs|coherent)
  2022-08-15  8:18 [PATCH] smatch_allocations: Give a hint about dma_alloc_(attrs|coherent) Christophe JAILLET
@ 2022-08-15 11:42 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2022-08-15 11:42 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: smatch

On Mon, Aug 15, 2022 at 10:18:31AM +0200, Christophe JAILLET wrote:
> In recent kernel, dma_alloc_attrs() and dma_alloc_coherent() zero the
> allocated memory.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> 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)

This code is aspirational.  I keep on creating lists of allocation
functions but hopefully it can all be pulled into one central location.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-15 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15  8:18 [PATCH] smatch_allocations: Give a hint about dma_alloc_(attrs|coherent) Christophe JAILLET
2022-08-15 11:42 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox