Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp668202ybg; Mon, 1 Jun 2020 11:12:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwR1ogdre9EY6vd/VsC25BgVeL0xXXJlTcxxuH/hNCVqUaYCYfGx0lJrkZfnHwoIYaNXV5 X-Received: by 2002:a17:906:b207:: with SMTP id p7mr13851591ejz.23.1591035155447; Mon, 01 Jun 2020 11:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035155; cv=none; d=google.com; s=arc-20160816; b=gO9tcEOyBYm8O7vARhz57YuYW9vmgOND3VbzAaSXs3Nu/Xo7v+8I7MKlj14BGupbWf 5dYyKQonxF8Z7YXZpM8uRjfMMIlCbKxvbbZlC4a0v0C1S4BsKtWn8YkfeV1BXUygisj3 rqAdqqTtKSjaWAyUHjPdxS2d7Koh9J0ehMP2et66R/wwoqJRR3IuXxUud/FBvgIUEh7k jStkwtgFX1lJxOyW0rZlDWT2WRRaJXvPUlQPViA7F1F104pBCNVSFb/Plg6VNjE2DKIh uYvbvkNLsdC5kp+2TDQi1+8IyBTKvHvvEFYNpHqZCxu5l4BHWRgxyJmtWlJA79hTr9i6 pTwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Hj3IAXEVOdOZJAsVRJVpyC4wo3oZV6V+0JtU0593M/c=; b=i9xP8E0WNMlM1RtyMQ/v+XE/i3ahkZmFHduDz+9OUCB1YJWL1QfiamFiRpNl0JiTAo nNLSdQEDkab8oRuFINZxjsIa5lna3ggT2GuGF25Z9hYP3LF03QIZ58c87ipvfZfZKNou Xs7NMrmB5oPZv4+BcL3D84dnZXvTsYM4l4AGLQWSbS5W6GkR7YHFocRfqE84ZQjo5t/R of3PTvHcaQi/PUAcODhSnekoemHZpxg9JmL6+5JQ7ezF8MPo2TNq907zrPRYMU0jQ7BQ nwsrPXP+PSG8mPzPdWEOvyCqP+AG50sZ/wm5h5YRysh/dE1ZcsJDDx0aJyrU5eosij+C hNyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="VPT3/G+p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc12si61114edb.348.2020.06.01.11.12.12; Mon, 01 Jun 2020 11:12:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="VPT3/G+p"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730859AbgFASJT (ORCPT + 99 others); Mon, 1 Jun 2020 14:09:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:55628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729952AbgFASJP (ORCPT ); Mon, 1 Jun 2020 14:09:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E1BD82068D; Mon, 1 Jun 2020 18:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034955; bh=xtOu0BkIPNelKFK0gXCMhqXoqae2xudnbZ6hnlXt4CI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPT3/G+pH+ubYEFsb2L8qyMvdrfGWN7w7gkKYXcwFqm94qEDVTvFgtJkrZ5Gz2tA1 gY4F/SHnJkBpzLX+UYN525MQ9dWcgt3Hg5WZtDJ89M0fKhAls1LO/xIpTgIH3y5y0u GIgiJ0zyK/qk7gGmteX+QFAxxcwJfwKvTLlD6sh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changming Liu , Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 087/142] ALSA: hwdep: fix a left shifting 1 by 31 UB bug Date: Mon, 1 Jun 2020 19:54:05 +0200 Message-Id: <20200601174046.921061890@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changming Liu [ Upstream commit fb8cd6481ffd126f35e9e146a0dcf0c4e8899f2e ] The "info.index" variable can be 31 in "1 << info.index". This might trigger an undefined behavior since 1 is signed. Fix this by casting 1 to 1u just to be sure "1u << 31" is defined. Signed-off-by: Changming Liu Cc: Link: https://lore.kernel.org/r/BL0PR06MB4548170B842CB055C9AF695DE5B00@BL0PR06MB4548.namprd06.prod.outlook.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/hwdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 00cb5aed10a9..28bec15b0959 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -216,12 +216,12 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw, if (info.index >= 32) return -EINVAL; /* check whether the dsp was already loaded */ - if (hw->dsp_loaded & (1 << info.index)) + if (hw->dsp_loaded & (1u << info.index)) return -EBUSY; err = hw->ops.dsp_load(hw, &info); if (err < 0) return err; - hw->dsp_loaded |= (1 << info.index); + hw->dsp_loaded |= (1u << info.index); return 0; } -- 2.25.1