From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Jasmin Fazlic <superfassl@gmail.com>,
Romain Perier <romain.perier@gmail.com>,
Leon Romanovsky <leon@kernel.org>,
Huilong Deng <denghuilong@cdjrlc.com>,
Tong Zhang <ztong0001@gmail.com>,
Allen Pais <allen.lkml@gmail.com>,
alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure
Date: Tue, 22 Jun 2021 22:02:02 +0300 [thread overview]
Message-ID: <YNIzqpVR6L2t/RwJ@mwanda> (raw)
The copy_to_user() function returns the number of bytes remaining to be
copied. It doesn't return negatives.
Fixes: 66c8f75919dd ("ALSA: hdsp: Fix assignment in if condition")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
sound/pci/rme9652/hdsp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index e3e4fabf4abf..8457a4bbc3df 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -4877,9 +4877,8 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
memset(&hdsp_version, 0, sizeof(hdsp_version));
hdsp_version.io_type = hdsp->io_type;
hdsp_version.firmware_rev = hdsp->firmware_rev;
- err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version));
- if (err < 0)
- return -EFAULT;
+ if (copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))
+ return -EFAULT;
break;
}
case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: {
--
2.30.2
next reply other threads:[~2021-06-22 19:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 19:02 Dan Carpenter [this message]
2021-06-22 19:33 ` [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure Takashi Iwai
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=YNIzqpVR6L2t/RwJ@mwanda \
--to=dan.carpenter@oracle.com \
--cc=allen.lkml@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=denghuilong@cdjrlc.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=leon@kernel.org \
--cc=perex@perex.cz \
--cc=romain.perier@gmail.com \
--cc=superfassl@gmail.com \
--cc=tiwai@suse.com \
--cc=ztong0001@gmail.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 NNTP newsgroup(s).