The step variable is initialized to zero. It changes in the loop, but if it doesn’t change it will remain zero. The patch added a variable check.
Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Andrey Shumilin shum.sdl@nppct.ru --- sound/firewire/amdtp-stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index c9f153f85ae6..b61aa30f43a9 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -168,7 +168,8 @@ static int apply_constraint_to_size(struct snd_pcm_hw_params *params, if (snd_interval_test(r, amdtp_rate_table[i])) step = max(step, amdtp_syt_intervals[i]); } - + if (step == 0) + return -EINVAL; t.min = roundup(s->min, step); t.max = rounddown(s->max, step); t.integer = 1;