* [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure
@ 2021-06-22 19:02 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-06-22 19:02 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai
Cc: Jasmin Fazlic, Romain Perier, Leon Romanovsky, Huilong Deng,
Tong Zhang, Allen Pais, alsa-devel, kernel-janitors
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure
@ 2021-06-22 19:02 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-06-22 19:02 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, Leon Romanovsky, Tong Zhang, kernel-janitors,
Allen Pais, Huilong Deng, Romain Perier, Jasmin Fazlic
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure
2021-06-22 19:02 ` Dan Carpenter
@ 2021-06-22 19:33 ` Takashi Iwai
-1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-06-22 19:33 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jaroslav Kysela, Takashi Iwai, Jasmin Fazlic, Romain Perier,
Leon Romanovsky, Huilong Deng, Tong Zhang, Allen Pais,
alsa-devel, kernel-janitors
On Tue, 22 Jun 2021 21:02:02 +0200,
Dan Carpenter wrote:
>
> 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>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure
@ 2021-06-22 19:33 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-06-22 19:33 UTC (permalink / raw)
To: Dan Carpenter
Cc: alsa-devel, Leon Romanovsky, Tong Zhang, kernel-janitors,
Takashi Iwai, Huilong Deng, Allen Pais, Romain Perier,
Jasmin Fazlic
On Tue, 22 Jun 2021 21:02:02 +0200,
Dan Carpenter wrote:
>
> 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>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-22 19:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 19:02 [PATCH] ALSA: hdsp: fix a test for copy_to_user() failure Dan Carpenter
2021-06-22 19:02 ` Dan Carpenter
2021-06-22 19:33 ` Takashi Iwai
2021-06-22 19:33 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.