From patchwork Sun Sep 7 19:43:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clemens Ladisch X-Patchwork-Id: 4859221 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B9497C0338 for ; Sun, 7 Sep 2014 19:42:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA2F220125 for ; Sun, 7 Sep 2014 19:42:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EBB0E20120 for ; Sun, 7 Sep 2014 19:42:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C34F32610A1; Sun, 7 Sep 2014 21:42:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_SORBS_WEB,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id D11732610B9; Sun, 7 Sep 2014 21:42:36 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9872B2610B9; Sun, 7 Sep 2014 21:42:35 +0200 (CEST) Received: from dehamd003.servertools24.de (dehamd003.servertools24.de [31.47.254.18]) by alsa0.perex.cz (Postfix) with ESMTP id E5A4F261622 for ; Sun, 7 Sep 2014 21:42:18 +0200 (CEST) Received: from [192.168.42.199] (tmo-096-176.customers.d1-online.com [80.187.96.176]) by dehamd003.servertools24.de (Postfix) with ESMTPSA id 61757F814B; Sun, 7 Sep 2014 21:41:51 +0200 (CEST) Message-ID: <540CB54B.8080701@ladisch.de> Date: Sun, 07 Sep 2014 21:43:07 +0200 From: Clemens Ladisch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Takashi Iwai References: <540CB520.50909@ladisch.de> In-Reply-To: <540CB520.50909@ladisch.de> X-PPP-Message-ID: <20140907194151.502537.63232@dehamd003.servertools24.de> X-PPP-Vhost: ladisch.de Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/5] ALSA: pcm: snd_interval_step: drop the min parameter X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The min parameter was not used by any caller. And if it were used, underflows in the calculations could lead to incorrect results. Signed-off-by: Clemens Ladisch --- sound/core/pcm_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 9acc77e..6fd5e1c 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1113,16 +1113,16 @@ int snd_interval_list(struct snd_interval *i, unsigned int count, EXPORT_SYMBOL(snd_interval_list); -static int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int step) +static int snd_interval_step(struct snd_interval *i, unsigned int step) { unsigned int n; int changed = 0; - n = (i->min - min) % step; + n = i->min % step; if (n != 0 || i->openmin) { i->min += step - n; changed = 1; } - n = (i->max - min) % step; + n = i->max % step; if (n != 0 || i->openmax) { i->max -= n; changed = 1; @@ -1427,7 +1427,7 @@ static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { unsigned long step = (unsigned long) rule->private; - return snd_interval_step(hw_param_interval(params, rule->var), 0, step); + return snd_interval_step(hw_param_interval(params, rule->var), step); } /**