From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH] ALSA: core: Drop superfluous no_free_ptr() for memdup_user() errors
Date: Mon, 2 Sep 2024 09:52:27 +0200 [thread overview]
Message-ID: <20240902075246.3743-1-tiwai@suse.de> (raw)
We used to wrap with no_free_ptr() for the return value from
memdup_user() with errors where the auto cleanup is applied. This was
a workaround because the initial implementation of kfree auto-cleanup
checked only NULL pointers.
Since recently, though, the kfree auto-cleanup checks with
IS_ERR_OR_NULL() (by the commit cd7eb8f83fcf ("mm/slab: make
__free(kfree) accept error pointers")), hence those workarounds became
superfluous. Let's drop them now.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/compress_offload.c | 2 +-
sound/core/control.c | 4 ++--
sound/core/pcm_native.c | 10 +++++-----
sound/core/timer.c | 4 ++--
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index f0008fa2d839..b8c0d6edbdd1 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -581,7 +581,7 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
*/
params = memdup_user((void __user *)arg, sizeof(*params));
if (IS_ERR(params))
- return PTR_ERR(no_free_ptr(params));
+ return PTR_ERR(params);
retval = snd_compress_check_input(params);
if (retval)
diff --git a/sound/core/control.c b/sound/core/control.c
index 7d7d592a8428..4f55f64c42e1 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1249,7 +1249,7 @@ static int snd_ctl_elem_read_user(struct snd_card *card,
control = memdup_user(_control, sizeof(*control));
if (IS_ERR(control))
- return PTR_ERR(no_free_ptr(control));
+ return PTR_ERR(control);
result = snd_power_ref_and_wait(card);
if (result)
@@ -1326,7 +1326,7 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
control = memdup_user(_control, sizeof(*control));
if (IS_ERR(control))
- return PTR_ERR(no_free_ptr(control));
+ return PTR_ERR(control);
card = file->card;
result = snd_power_ref_and_wait(card);
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 4057f9f10aee..44381514f695 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -582,7 +582,7 @@ static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream,
params = memdup_user(_params, sizeof(*params));
if (IS_ERR(params))
- return PTR_ERR(no_free_ptr(params));
+ return PTR_ERR(params);
err = snd_pcm_hw_refine(substream, params);
if (err < 0)
@@ -872,7 +872,7 @@ static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream,
params = memdup_user(_params, sizeof(*params));
if (IS_ERR(params))
- return PTR_ERR(no_free_ptr(params));
+ return PTR_ERR(params);
err = snd_pcm_hw_params(substream, params);
if (err < 0)
@@ -3243,7 +3243,7 @@ static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels);
if (IS_ERR(bufs))
- return PTR_ERR(no_free_ptr(bufs));
+ return PTR_ERR(bufs);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
else
@@ -4032,7 +4032,7 @@ static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream,
oparams = memdup_user(_oparams, sizeof(*oparams));
if (IS_ERR(oparams))
- return PTR_ERR(no_free_ptr(oparams));
+ return PTR_ERR(oparams);
snd_pcm_hw_convert_from_old_params(params, oparams);
err = snd_pcm_hw_refine(substream, params);
if (err < 0)
@@ -4061,7 +4061,7 @@ static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream,
oparams = memdup_user(_oparams, sizeof(*oparams));
if (IS_ERR(oparams))
- return PTR_ERR(no_free_ptr(oparams));
+ return PTR_ERR(oparams);
snd_pcm_hw_convert_from_old_params(params, oparams);
err = snd_pcm_hw_params(substream, params);
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 7610f102360d..1d13f6c1d506 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1615,7 +1615,7 @@ static int snd_timer_user_ginfo(struct file *file,
ginfo = memdup_user(_ginfo, sizeof(*ginfo));
if (IS_ERR(ginfo))
- return PTR_ERR(no_free_ptr(ginfo));
+ return PTR_ERR(ginfo);
tid = ginfo->tid;
memset(ginfo, 0, sizeof(*ginfo));
@@ -2190,7 +2190,7 @@ static int snd_utimer_ioctl_create(struct file *file,
utimer_info = memdup_user(_utimer_info, sizeof(*utimer_info));
if (IS_ERR(utimer_info))
- return PTR_ERR(no_free_ptr(utimer_info));
+ return PTR_ERR(utimer_info);
err = snd_utimer_create(utimer_info, &utimer);
if (err < 0)
--
2.43.0
reply other threads:[~2024-09-02 7:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240902075246.3743-1-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-sound@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