Linux-Sparse Archive mirror
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <dan.carpenter@oracle.com>, <679652+tititiou36@users.noreply.github.com>
Cc: <linux-sparse@vger.kernel.org>
Subject: Spurious warning about using kzalloc instead of kmalloc
Date: Wed, 3 Jul 2024 16:02:35 +0100	[thread overview]
Message-ID: <65fee38d-8b16-43b9-b16e-3afdc899a2cf@opensource.cirrus.com> (raw)

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.

             reply	other threads:[~2024-07-03 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 15:02 Richard Fitzgerald [this message]
2024-07-03 15:28 ` Spurious warning about using kzalloc instead of kmalloc Dan Carpenter

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=65fee38d-8b16-43b9-b16e-3afdc899a2cf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=679652+tititiou36@users.noreply.github.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-sparse@vger.kernel.org \
    /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).