All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: pcm: Fix incorrect numerator selection in snd_interval_ratden()
@ 2026-11-20 11:36 Sreeraj S Kurup
  2026-11-20 17:04 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Sreeraj S Kurup @ 2026-11-20 11:36 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-kernel, linux-sound, Sreeraj S Kurup

When the calculated numerator is smaller than num_min, the
function incorrectly sets it to num_max instead of num_min.

This can produce an invalid interval by making the calculated
minimum numerator larger than the maximum numerator, even when
a valid range exists.

Set the numerator to num_min when it falls below the minimum
allowed value. This allows the function to calculate the correct
lower bound and prevents valid intervals from being rejected.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 sound/core/pcm_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index bb16738bb591..65c7472ef22e 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -966,7 +966,7 @@ static int snd_interval_ratden(struct snd_interval *i,
 		if (num > rats[k].num_max)
 			continue;
 		if (num < rats[k].num_min)
-			num = rats[k].num_max;
+			num = rats[k].num_min;
 		else {
 			unsigned int r;
 			r = (num - rats[k].num_min) % rats[k].num_step;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 11:36 [PATCH] ALSA: pcm: Fix incorrect numerator selection in snd_interval_ratden() Sreeraj S Kurup
2026-11-20 17:04 ` 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.