From patchwork Mon Feb 22 09:45:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clemens Ladisch X-Patchwork-Id: 81114 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1M9jp4W016732 for ; Mon, 22 Feb 2010 09:45:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752489Ab0BVJpL (ORCPT ); Mon, 22 Feb 2010 04:45:11 -0500 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:48324 "EHLO out2.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751965Ab0BVJpK (ORCPT ); Mon, 22 Feb 2010 04:45:10 -0500 Received: from compute1.internal (compute1 [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 29EE9E251D; Mon, 22 Feb 2010 04:45:09 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 22 Feb 2010 04:45:09 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:subject:content-type:content-transfer-encoding; s=smtpout; bh=eUOY7L958YxctupG2S35YkE/Oj4=; b=N74Yq1Ou9DSpJM4K2x3mDKmMTkL9hsXDK14RMx/5BiOfx1meje3T5+UmKomQeXUHFOBsSgkYz25QWw7evc6xndPJNPPNApxiGK/b6ZY1BLjNKmxOVfky88oCYIIxSn7X971EtPvg7MzwkQilsAk0v/ZN2Ezu1rDepi1XGU0B7wI= X-Sasl-enc: snH8vQErexCEG7kJgWB6be0RMajsVT5mVgYq3hBNvuSy 1266831908 Received: from [10.1.2.38] (srv004.schk01.int.dmc-one.com [85.232.8.141]) by mail.messagingengine.com (Postfix) with ESMTPSA id 6D29E4BB2E4; Mon, 22 Feb 2010 04:45:08 -0500 (EST) Message-ID: <4B825223.7030904@ladisch.de> Date: Mon, 22 Feb 2010 10:45:07 +0100 From: Clemens Ladisch User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cx88-alsa: prevent out-of-range volume setting Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Feb 2010 09:45:52 +0000 (UTC) --- linux/drivers/media/video/cx88/cx88-alsa.c +++ linux/drivers/media/video/cx88/cx88-alsa.c @@ -583,16 +583,18 @@ static int snd_cx88_volume_put(struct sn { snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); struct cx88_core *core=chip->core; - int v, b; + int left, right, v, b; int changed = 0; u32 old; - b = value->value.integer.value[1] - value->value.integer.value[0]; + left = value->value.integer.value[0] & 0x3f; + right = value->value.integer.value[1] & 0x3f; + b = right - left; if (b < 0) { - v = 0x3f - value->value.integer.value[0]; + v = 0x3f - left; b = (-b) | 0x40; } else { - v = 0x3f - value->value.integer.value[1]; + v = 0x3f - right; } /* Do we really know this will always be called with IRQs on? */ spin_lock_irq(&chip->reg_lock);