Commit 51303d21 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

ALSA: hdsp - Fix zero division

patch 2a3988f6 in mainline.

Fix zero-division bug in the calculation dds offset.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
Cc: Maarten Bressers <mbressers@gmail.com>
Cc: gentoo kernel <kernel@gentoo.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6c7ad737
...@@ -3108,6 +3108,9 @@ static int hdsp_dds_offset(struct hdsp *hdsp) ...@@ -3108,6 +3108,9 @@ static int hdsp_dds_offset(struct hdsp *hdsp)
unsigned int dds_value = hdsp->dds_value; unsigned int dds_value = hdsp->dds_value;
int system_sample_rate = hdsp->system_sample_rate; int system_sample_rate = hdsp->system_sample_rate;
if (!dds_value)
return 0;
n = DDS_NUMERATOR; n = DDS_NUMERATOR;
/* /*
* dds_value = n / rate * dds_value = n / rate
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment