Commit 40a024b8 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: core: Drop superfluous no_free_ptr() for memdup_user() errors

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 cd7eb8f8 ("mm/slab: make
__free(kfree) accept error pointers")), hence those workarounds became
superfluous.  Let's drop them now.

Link: https://patch.msgid.link/20240902075246.3743-1-tiwai@suse.de


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f48bd50a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+2 −2
Original line number Diff line number Diff line
@@ -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);
+5 −5
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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)