* [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
@ 2018-10-10 14:15 ` Colin King
0 siblings, 0 replies; 7+ messages in thread
From: Colin King @ 2018-10-10 14:15 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, alsa-devel; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the return from pnp_port_start is being checked for validity
by checking if it is greater or equal to zero, however, the return
is unsigned and hence this check is always true. An 0 return from
pnp_port_start is actually an error, so fix the check by checking
for validity when it is non-zero.
Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
sound/isa/cs423x/cs4236.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 70559e59d18f..2211c39d2c18 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
mpu_irq[dev] = SNDRV_AUTO_IRQ;
} else {
mpu_port[dev] = pnp_port_start(pdev, 0);
- if (mpu_irq[dev] >= 0 &&
+ if (!mpu_irq[dev] &&
pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
mpu_irq[dev] = pnp_irq(pdev, 0);
} else {
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
@ 2018-10-10 14:15 ` Colin King
0 siblings, 0 replies; 7+ messages in thread
From: Colin King @ 2018-10-10 14:15 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, alsa-devel; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the return from pnp_port_start is being checked for validity
by checking if it is greater or equal to zero, however, the return
is unsigned and hence this check is always true. An 0 return from
pnp_port_start is actually an error, so fix the check by checking
for validity when it is non-zero.
Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
sound/isa/cs423x/cs4236.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 70559e59d18f..2211c39d2c18 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
mpu_irq[dev] = SNDRV_AUTO_IRQ;
} else {
mpu_port[dev] = pnp_port_start(pdev, 0);
- if (mpu_irq[dev] >= 0 &&
+ if (!mpu_irq[dev] &&
pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
mpu_irq[dev] = pnp_irq(pdev, 0);
} else {
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
2018-10-10 14:15 ` Colin King
(?)
@ 2018-10-11 15:42 ` Takashi Iwai
-1 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2018-10-11 15:42 UTC (permalink / raw)
To: Colin King; +Cc: alsa-devel, Jaroslav Kysela, kernel-janitors, linux-kernel
On Wed, 10 Oct 2018 16:15:42 +0200,
Colin King wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the return from pnp_port_start is being checked for validity
> by checking if it is greater or equal to zero, however, the return
> is unsigned and hence this check is always true. An 0 return from
> pnp_port_start is actually an error, so fix the check by checking
> for validity when it is non-zero.
I guess you're confused between mpu_port[] and mpu_irq[]?
The check "mpu_irq[] >= 0" here is to see the module parameter value
from user.
thanks,
Takashi
> Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
>
> Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> sound/isa/cs423x/cs4236.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
> index 70559e59d18f..2211c39d2c18 100644
> --- a/sound/isa/cs423x/cs4236.c
> +++ b/sound/isa/cs423x/cs4236.c
> @@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
> mpu_irq[dev] = SNDRV_AUTO_IRQ;
> } else {
> mpu_port[dev] = pnp_port_start(pdev, 0);
> - if (mpu_irq[dev] >= 0 &&
> + if (!mpu_irq[dev] &&
> pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
> mpu_irq[dev] = pnp_irq(pdev, 0);
> } else {
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
@ 2018-10-11 15:42 ` Takashi Iwai
0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2018-10-11 15:42 UTC (permalink / raw)
To: Colin King; +Cc: alsa-devel, kernel-janitors, linux-kernel
On Wed, 10 Oct 2018 16:15:42 +0200,
Colin King wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the return from pnp_port_start is being checked for validity
> by checking if it is greater or equal to zero, however, the return
> is unsigned and hence this check is always true. An 0 return from
> pnp_port_start is actually an error, so fix the check by checking
> for validity when it is non-zero.
I guess you're confused between mpu_port[] and mpu_irq[]?
The check "mpu_irq[] >= 0" here is to see the module parameter value
from user.
thanks,
Takashi
> Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
>
> Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> sound/isa/cs423x/cs4236.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
> index 70559e59d18f..2211c39d2c18 100644
> --- a/sound/isa/cs423x/cs4236.c
> +++ b/sound/isa/cs423x/cs4236.c
> @@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
> mpu_irq[dev] = SNDRV_AUTO_IRQ;
> } else {
> mpu_port[dev] = pnp_port_start(pdev, 0);
> - if (mpu_irq[dev] >= 0 &&
> + if (!mpu_irq[dev] &&
> pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
> mpu_irq[dev] = pnp_irq(pdev, 0);
> } else {
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
@ 2018-10-11 15:42 ` Takashi Iwai
0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2018-10-11 15:42 UTC (permalink / raw)
To: Colin King; +Cc: alsa-devel, kernel-janitors, linux-kernel
On Wed, 10 Oct 2018 16:15:42 +0200,
Colin King wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the return from pnp_port_start is being checked for validity
> by checking if it is greater or equal to zero, however, the return
> is unsigned and hence this check is always true. An 0 return from
> pnp_port_start is actually an error, so fix the check by checking
> for validity when it is non-zero.
I guess you're confused between mpu_port[] and mpu_irq[]?
The check "mpu_irq[] >= 0" here is to see the module parameter value
from user.
thanks,
Takashi
> Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
>
> Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> sound/isa/cs423x/cs4236.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
> index 70559e59d18f..2211c39d2c18 100644
> --- a/sound/isa/cs423x/cs4236.c
> +++ b/sound/isa/cs423x/cs4236.c
> @@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
> mpu_irq[dev] = SNDRV_AUTO_IRQ;
> } else {
> mpu_port[dev] = pnp_port_start(pdev, 0);
> - if (mpu_irq[dev] >= 0 &&
> + if (!mpu_irq[dev] &&
> pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
> mpu_irq[dev] = pnp_irq(pdev, 0);
> } else {
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
2018-10-11 15:42 ` Takashi Iwai
@ 2018-10-11 15:47 ` Colin Ian King
-1 siblings, 0 replies; 7+ messages in thread
From: Colin Ian King @ 2018-10-11 15:47 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Jaroslav Kysela, kernel-janitors, linux-kernel
On 11/10/18 16:42, Takashi Iwai wrote:
> On Wed, 10 Oct 2018 16:15:42 +0200,
> Colin King wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently the return from pnp_port_start is being checked for validity
>> by checking if it is greater or equal to zero, however, the return
>> is unsigned and hence this check is always true. An 0 return from
>> pnp_port_start is actually an error, so fix the check by checking
>> for validity when it is non-zero.
>
> I guess you're confused between mpu_port[] and mpu_irq[]?
> The check "mpu_irq[] >= 0" here is to see the module parameter value
> from user.
Yep, you are quite correct. I overlooked this. My bad.
>
>
> thanks,
>
> Takashi
>
>> Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
>>
>> Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>> sound/isa/cs423x/cs4236.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
>> index 70559e59d18f..2211c39d2c18 100644
>> --- a/sound/isa/cs423x/cs4236.c
>> +++ b/sound/isa/cs423x/cs4236.c
>> @@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
>> mpu_irq[dev] = SNDRV_AUTO_IRQ;
>> } else {
>> mpu_port[dev] = pnp_port_start(pdev, 0);
>> - if (mpu_irq[dev] >= 0 &&
>> + if (!mpu_irq[dev] &&
>> pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
>> mpu_irq[dev] = pnp_irq(pdev, 0);
>> } else {
>> --
>> 2.17.1
>>
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start
@ 2018-10-11 15:47 ` Colin Ian King
0 siblings, 0 replies; 7+ messages in thread
From: Colin Ian King @ 2018-10-11 15:47 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel, Jaroslav Kysela, kernel-janitors, linux-kernel
On 11/10/18 16:42, Takashi Iwai wrote:
> On Wed, 10 Oct 2018 16:15:42 +0200,
> Colin King wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently the return from pnp_port_start is being checked for validity
>> by checking if it is greater or equal to zero, however, the return
>> is unsigned and hence this check is always true. An 0 return from
>> pnp_port_start is actually an error, so fix the check by checking
>> for validity when it is non-zero.
>
> I guess you're confused between mpu_port[] and mpu_irq[]?
> The check "mpu_irq[] >= 0" here is to see the module parameter value
> from user.
Yep, you are quite correct. I overlooked this. My bad.
>
>
> thanks,
>
> Takashi
>
>> Detected by CoverityScan, CID#1468334 ("Unsigned compared to 0")
>>
>> Fixes: a9824c868a2c ("[ALSA] Add CS4232 PnP BIOS support")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>> sound/isa/cs423x/cs4236.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
>> index 70559e59d18f..2211c39d2c18 100644
>> --- a/sound/isa/cs423x/cs4236.c
>> +++ b/sound/isa/cs423x/cs4236.c
>> @@ -292,7 +292,7 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
>> mpu_irq[dev] = SNDRV_AUTO_IRQ;
>> } else {
>> mpu_port[dev] = pnp_port_start(pdev, 0);
>> - if (mpu_irq[dev] >= 0 &&
>> + if (!mpu_irq[dev] &&
>> pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) {
>> mpu_irq[dev] = pnp_irq(pdev, 0);
>> } else {
>> --
>> 2.17.1
>>
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-10-11 15:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 14:15 [PATCH] ALSA: cs4236: fix return check from call to pnp_port_start Colin King
2018-10-10 14:15 ` Colin King
2018-10-11 15:42 ` Takashi Iwai
2018-10-11 15:42 ` Takashi Iwai
2018-10-11 15:42 ` Takashi Iwai
2018-10-11 15:47 ` Colin Ian King
2018-10-11 15:47 ` Colin Ian King
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.