From patchwork Wed Jan 3 15:43:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 123329 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp10320841qgn; Wed, 3 Jan 2018 07:43:13 -0800 (PST) X-Google-Smtp-Source: ACJfBouE8ITUCpzIOxhSjA6UnTWhXxNqUE9aZXBWb2Ge+m/xUMn9l0HIFZL3RDRVzTbdtGAw5z8e X-Received: by 10.28.132.209 with SMTP id g200mr1599369wmd.91.1514994193494; Wed, 03 Jan 2018 07:43:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514994193; cv=none; d=google.com; s=arc-20160816; b=HbeXlDuqdW3Xw98SrUrDqNMtwYrF9l5xNI8brmu6qAFUI4sBMcvtabC3qqQV2icejk ahh1vaSdPhfY5sstNuks0v8Pu+9wBovkBf0jbZT4bPfmolVe6+zV+ClMAeFYsRA/DHPU MW7z7XBbeP3nm9F+RsWR5k8v2ivVGvpiSXS3HymPeKzR8f1kVAi21SuivA3iX/yiloaP mS2F4w/87AzqpaPf0TlFbgHL3wHvk8kw6AeLggjePvnhZG3kVdSfppCVLOy+K3H0DIAW YtG/qmUiQrNY1RCDjekhhKjfr746jvJdQGsqYTEdu8w4qeXStvyAw2ra8dLf+uaKVwKq F7ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=GCGoRhT9R+vtxgt6Z6UBDz8AglROHXe252m5RrtsC28=; b=C+idrHiUo8Kkxb0slZtXoHdbXEweZkUpVRkpSiK1MUgTPMN7qUbKCOU5uwQPy4d3Wy gExfm7jNXGZIqXkEQP/negPwoDO4jhHopFAQvL/0k8R91xkBrmr3tcF+eIp0mV9PGt1N 5iq5NGRNO9bQXTe+kif/sM+wBlxPVOpdavbROiGDSkE1qqK1dkSQ6MlMh8p5x1gUfVjq 0EK3FrxTKN2zS4C5DSK2adZtomdRzYZWp7Amfiwvf27XluS1M+JYKkREQvudZ7miT+0/ qHE3SyX/2Gi57iRUupkfD5tISgOdsR+GR74oeawIRYc/qYA67iw5G5XdmVnnYZdXFRnc /dgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=gtZuKIml; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id q11si860715wmf.171.2018.01.03.07.43.13; Wed, 03 Jan 2018 07:43:13 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=gtZuKIml; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5822826766E; Wed, 3 Jan 2018 16:43:12 +0100 (CET) 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 2FAA5267671; Wed, 3 Jan 2018 16:43:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id E9DF826766D for ; Wed, 3 Jan 2018 16:43:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=0RY8U2oHOvPi2bDQwHFMXpp/uFPpQmWVVn5ff4hgs5I=; b=gtZuKImlziol BtvdEy/a54fjqWSXmx2r/zl5jlPy8tAnoKklN8fy/4eA2zmFG+c2aExO9KumjYWNxxxOnoVksXnm7 CUt1BrBNXtzv8t9ISSr4/q3BIeTSkE8zZTtG8nZ6tFgiEvUqhSJlqJ8lnRoD4nCuKSUh6mK3Bpwmb ejLXs=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eWlC4-0005WT-U5; Wed, 03 Jan 2018 15:43:04 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1eWlC4-0000Sn-FD; Wed, 03 Jan 2018 15:43:04 +0000 From: Mark Brown To: Banajit Goswami In-Reply-To: <1514781614-6039-1-git-send-email-bgoswami@codeaurora.org> Message-Id: Date: Wed, 03 Jan 2018 15:43:04 +0000 Cc: plai@qti.qualcomm.com, alsa-devel@alsa-project.org, broonie@kernel.org Subject: [alsa-devel] Applied "ASoC: change mask in snd_soc_get/put_volsw_sx to unsigned int" to the asoc tree 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: change mask in snd_soc_get/put_volsw_sx to unsigned int has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From b9f902b7fd800214b5598a636ceb74bfe2db63be Mon Sep 17 00:00:00 2001 From: Banajit Goswami Date: Sun, 31 Dec 2017 20:40:14 -0800 Subject: [PATCH] ASoC: change mask in snd_soc_get/put_volsw_sx to unsigned int If the result of (min + max) is negative in functions snd_soc_get_volsw_sx() or snd_soc_put_volsw_sx(), there will be an overflow for the variable 'mask'. UBSAN: Undefined behaviour in sound/soc/soc-ops.c:382:6 signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fix this by updating the variable type of 'mask' to unsigned int. Signed-off-by: Banajit Goswami Signed-off-by: Mark Brown --- sound/soc/soc-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.15.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 500f98c730b9..7144a51ddfa9 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -378,7 +378,7 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol, unsigned int rshift = mc->rshift; int max = mc->max; int min = mc->min; - int mask = (1 << (fls(min + max) - 1)) - 1; + unsigned int mask = (1 << (fls(min + max) - 1)) - 1; unsigned int val; int ret; @@ -423,7 +423,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, unsigned int rshift = mc->rshift; int max = mc->max; int min = mc->min; - int mask = (1 << (fls(min + max) - 1)) - 1; + unsigned int mask = (1 << (fls(min + max) - 1)) - 1; int err = 0; unsigned int val, val_mask, val2 = 0;