From: Dan Carpenter <dan.carpenter@linaro.org>
To: Richard Fitzgerald <rf@opensource.cirrus.com>
Cc: dan.carpenter@oracle.com,
679652+tititiou36@users.noreply.github.com,
linux-sparse@vger.kernel.org
Subject: Re: Spurious warning about using kzalloc instead of kmalloc
Date: Wed, 3 Jul 2024 17:28:24 +0200 [thread overview]
Message-ID: <957a021a-2f35-471d-8478-5bc9d8ead457@suswa.mountain> (raw)
In-Reply-To: <65fee38d-8b16-43b9-b16e-3afdc899a2cf@opensource.cirrus.com>
On Wed, Jul 03, 2024 at 04:02:35PM +0100, Richard Fitzgerald wrote:
> As far as I can tell from the limited commit message and comments, the
> purpose of commit 6a74b670 ("Refactor and add new functions tested by
> check_kvmalloc_array_zero()") is to suggest that uses of __GFP_ZERO are
> replaced by the appropriate zeroing allocator, like kzalloc.
>
> But this warning is being reported on the function
> cs_dsp_coeff_read_ctrl_raw() in drivers/firmware/cirrus/cs_dsp.c
>
> That function does not have a __GFP_ZERO, the kmalloc is:
>
> scratch = kmalloc(len, GFP_KERNEL | GFP_DMA);
>
> and it is intentional to use kmalloc because the entire buffer is
> then overwritten, so it's inefficient to zero-fill it first.
Sorry about that. To be honest, I don't look at those results because
it's a style issue and I tend to ignore those. So I didn't see the
results were all wrong now.
The issue is that they redifined __GFP_ flags to be much more
complicated macros instead of just 0x001000 or whatever it was.
I've been meaning to fix this. I'll disable the check_kvmalloc_array_zero()
check until it's fixed. But really I need to fix this because I need to
know when GFP_ATOMIC is set.
Thanks for the bug report.
regards,
dan carpenter
prev parent reply other threads:[~2024-07-03 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 15:02 Spurious warning about using kzalloc instead of kmalloc Richard Fitzgerald
2024-07-03 15:28 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=957a021a-2f35-471d-8478-5bc9d8ead457@suswa.mountain \
--to=dan.carpenter@linaro.org \
--cc=679652+tititiou36@users.noreply.github.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-sparse@vger.kernel.org \
--cc=rf@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).