* [PATCH] ALSA: firewire-lib: fix error codes for allocation failure
@ 2021-06-05 12:46 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-06-05 12:46 UTC (permalink / raw)
To: Clemens Ladisch, Takashi Sakamoto
Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, kernel-janitors
Return -ENOMEM if kcalloc() fails. Currently the code returns success.
Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
sound/firewire/amdtp-stream.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 945597ffacc2..b37cec3cc579 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -1625,8 +1625,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
s->ctx_data.tx.cache.tail = 0;
s->ctx_data.tx.cache.descs = kcalloc(s->ctx_data.tx.cache.size,
sizeof(*s->ctx_data.tx.cache.descs), GFP_KERNEL);
- if (!s->ctx_data.tx.cache.descs)
+ if (!s->ctx_data.tx.cache.descs) {
+ err = -ENOMEM;
goto err_context;
+ }
}
} else {
static const struct {
@@ -1643,8 +1645,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
};
s->ctx_data.rx.seq.descs = kcalloc(queue_size, sizeof(*s->ctx_data.rx.seq.descs), GFP_KERNEL);
- if (!s->ctx_data.rx.seq.descs)
+ if (!s->ctx_data.rx.seq.descs) {
+ err = -ENOMEM;
goto err_context;
+ }
s->ctx_data.rx.seq.size = queue_size;
s->ctx_data.rx.seq.tail = 0;
s->ctx_data.rx.seq.head = 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ALSA: firewire-lib: fix error codes for allocation failure
@ 2021-06-05 12:46 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-06-05 12:46 UTC (permalink / raw)
To: Clemens Ladisch, Takashi Sakamoto
Cc: alsa-devel, kernel-janitors, Takashi Iwai
Return -ENOMEM if kcalloc() fails. Currently the code returns success.
Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
sound/firewire/amdtp-stream.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 945597ffacc2..b37cec3cc579 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -1625,8 +1625,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
s->ctx_data.tx.cache.tail = 0;
s->ctx_data.tx.cache.descs = kcalloc(s->ctx_data.tx.cache.size,
sizeof(*s->ctx_data.tx.cache.descs), GFP_KERNEL);
- if (!s->ctx_data.tx.cache.descs)
+ if (!s->ctx_data.tx.cache.descs) {
+ err = -ENOMEM;
goto err_context;
+ }
}
} else {
static const struct {
@@ -1643,8 +1645,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
};
s->ctx_data.rx.seq.descs = kcalloc(queue_size, sizeof(*s->ctx_data.rx.seq.descs), GFP_KERNEL);
- if (!s->ctx_data.rx.seq.descs)
+ if (!s->ctx_data.rx.seq.descs) {
+ err = -ENOMEM;
goto err_context;
+ }
s->ctx_data.rx.seq.size = queue_size;
s->ctx_data.rx.seq.tail = 0;
s->ctx_data.rx.seq.head = 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: fix error codes for allocation failure
2021-06-05 12:46 ` Dan Carpenter
@ 2021-06-06 0:26 ` Takashi Sakamoto
-1 siblings, 0 replies; 6+ messages in thread
From: Takashi Sakamoto @ 2021-06-06 0:26 UTC (permalink / raw)
To: Dan Carpenter
Cc: Clemens Ladisch, Jaroslav Kysela, Takashi Iwai, alsa-devel,
kernel-janitors
Hi,
On Sat, Jun 05, 2021 at 03:46:39PM +0300, Dan Carpenter wrote:
> Return -ENOMEM if kcalloc() fails. Currently the code returns success.
>
> Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
> Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> sound/firewire/amdtp-stream.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
> index 945597ffacc2..b37cec3cc579 100644
> --- a/sound/firewire/amdtp-stream.c
> +++ b/sound/firewire/amdtp-stream.c
> @@ -1625,8 +1625,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
> s->ctx_data.tx.cache.tail = 0;
> s->ctx_data.tx.cache.descs = kcalloc(s->ctx_data.tx.cache.size,
> sizeof(*s->ctx_data.tx.cache.descs), GFP_KERNEL);
> - if (!s->ctx_data.tx.cache.descs)
> + if (!s->ctx_data.tx.cache.descs) {
> + err = -ENOMEM;
> goto err_context;
> + }
> }
> } else {
> static const struct {
> @@ -1643,8 +1645,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
> };
>
> s->ctx_data.rx.seq.descs = kcalloc(queue_size, sizeof(*s->ctx_data.rx.seq.descs), GFP_KERNEL);
> - if (!s->ctx_data.rx.seq.descs)
> + if (!s->ctx_data.rx.seq.descs) {
> + err = -ENOMEM;
> goto err_context;
> + }
> s->ctx_data.rx.seq.size = queue_size;
> s->ctx_data.rx.seq.tail = 0;
> s->ctx_data.rx.seq.head = 0;
> --
> 2.30.2
Indeed... Nice to catch it.
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Thanks
Takashi Sakamoto.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: fix error codes for allocation failure
@ 2021-06-06 0:26 ` Takashi Sakamoto
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Sakamoto @ 2021-06-06 0:26 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kernel-janitors, alsa-devel, Clemens Ladisch, Takashi Iwai
Hi,
On Sat, Jun 05, 2021 at 03:46:39PM +0300, Dan Carpenter wrote:
> Return -ENOMEM if kcalloc() fails. Currently the code returns success.
>
> Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
> Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> sound/firewire/amdtp-stream.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
> index 945597ffacc2..b37cec3cc579 100644
> --- a/sound/firewire/amdtp-stream.c
> +++ b/sound/firewire/amdtp-stream.c
> @@ -1625,8 +1625,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
> s->ctx_data.tx.cache.tail = 0;
> s->ctx_data.tx.cache.descs = kcalloc(s->ctx_data.tx.cache.size,
> sizeof(*s->ctx_data.tx.cache.descs), GFP_KERNEL);
> - if (!s->ctx_data.tx.cache.descs)
> + if (!s->ctx_data.tx.cache.descs) {
> + err = -ENOMEM;
> goto err_context;
> + }
> }
> } else {
> static const struct {
> @@ -1643,8 +1645,10 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
> };
>
> s->ctx_data.rx.seq.descs = kcalloc(queue_size, sizeof(*s->ctx_data.rx.seq.descs), GFP_KERNEL);
> - if (!s->ctx_data.rx.seq.descs)
> + if (!s->ctx_data.rx.seq.descs) {
> + err = -ENOMEM;
> goto err_context;
> + }
> s->ctx_data.rx.seq.size = queue_size;
> s->ctx_data.rx.seq.tail = 0;
> s->ctx_data.rx.seq.head = 0;
> --
> 2.30.2
Indeed... Nice to catch it.
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Thanks
Takashi Sakamoto.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: fix error codes for allocation failure
2021-06-05 12:46 ` Dan Carpenter
@ 2021-06-06 8:05 ` Takashi Iwai
-1 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2021-06-06 8:05 UTC (permalink / raw)
To: Dan Carpenter
Cc: Clemens Ladisch, Takashi Sakamoto, Jaroslav Kysela, Takashi Iwai,
alsa-devel, kernel-janitors
On Sat, 05 Jun 2021 14:46:39 +0200,
Dan Carpenter wrote:
>
> Return -ENOMEM if kcalloc() fails. Currently the code returns success.
>
> Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
> Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: firewire-lib: fix error codes for allocation failure
@ 2021-06-06 8:05 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2021-06-06 8:05 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel, Clemens Ladisch, kernel-janitors, Takashi Iwai
On Sat, 05 Jun 2021 14:46:39 +0200,
Dan Carpenter wrote:
>
> Return -ENOMEM if kcalloc() fails. Currently the code returns success.
>
> Fixes: f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
> Fixes: 6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-06 8:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 12:46 [PATCH] ALSA: firewire-lib: fix error codes for allocation failure Dan Carpenter
2021-06-05 12:46 ` Dan Carpenter
2021-06-06 0:26 ` Takashi Sakamoto
2021-06-06 0:26 ` Takashi Sakamoto
2021-06-06 8:05 ` Takashi Iwai
2021-06-06 8:05 ` 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.