From nobody Mon Feb 9 08:38:23 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1561654820; cv=none; d=zoho.com; s=zohoarc; b=cr+ti/kZJSUJJ3keJmprORkO7FRmuy0XEjYi02fzcKXsCgSxUyX7K0uWDz1DKYz6bZc04xemj8RQ2/tqGquHTZSqbZtg4tnnX2Z0Xmg+5q4YM8hS2AjqQ9Yct2OKMLHNrCnYcmm/a9UcmsJdNQ3wAgOC5jRr3trZeAopvlP+it4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561654820; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=zQqKCr02j1TnB7XbK1eZ1/kXWGjaV4KS4klEE46P+i0=; b=RK75JiJQb/kDLtleX0goTNc4aLVsgogtcfDIuMzRQead77wGTUr6X2CiY/wpmfX3yfoV66OgU5jrDJt80HuwxOPyHfR6vqIUcWXns4UuF8r1Rb3FHGUv9osqCyeUk8sy4oLhfgcXZczWXsk5VpkwE9O1/q27jw+0aUbgCH5J/3Q= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1561654820696949.8100248251088; Thu, 27 Jun 2019 10:00:20 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgXjh-0004CF-8C; Thu, 27 Jun 2019 16:59:01 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgXjf-0004CA-P5 for xen-devel@lists.xenproject.org; Thu, 27 Jun 2019 16:58:59 +0000 Received: from youngberry.canonical.com (unknown [91.189.89.112]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id db0b6970-98fc-11e9-8a29-afeaacfaa1ce; Thu, 27 Jun 2019 16:58:58 +0000 (UTC) Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hgXjZ-000846-Sc; Thu, 27 Jun 2019 16:58:53 +0000 X-Inumbo-ID: db0b6970-98fc-11e9-8a29-afeaacfaa1ce From: Colin King To: Oleksandr Andrushchenko , Jaroslav Kysela , Takashi Iwai , xen-devel@lists.xenproject.org, alsa-devel@alsa-project.org Date: Thu, 27 Jun 2019 17:58:53 +0100 Message-Id: <20190627165853.21864-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] ALSA: xen-front: fix unintention integer overflow on left shifts X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Colin Ian King Shifting the integer value 1 is evaluated using 32-bit arithmetic and then used in an expression that expects a 64-bit value, so there is potentially an integer overflow. Fix this by using the BIT_ULL macro to perform the shift. Addresses-Coverity: ("Unintentional integer overflow") Signed-off-by: Colin Ian King --- sound/xen/xen_snd_front_alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/xen/xen_snd_front_alsa.c b/sound/xen/xen_snd_front_alsa.c index b14ab512c2ce..e01631959ed8 100644 --- a/sound/xen/xen_snd_front_alsa.c +++ b/sound/xen/xen_snd_front_alsa.c @@ -196,7 +196,7 @@ static u64 to_sndif_formats_mask(u64 alsa_formats) mask =3D 0; for (i =3D 0; i < ARRAY_SIZE(ALSA_SNDIF_FORMATS); i++) if (pcm_format_to_bits(ALSA_SNDIF_FORMATS[i].alsa) & alsa_formats) - mask |=3D 1 << ALSA_SNDIF_FORMATS[i].sndif; + mask |=3D BIT_ULL(ALSA_SNDIF_FORMATS[i].sndif); =20 return mask; } @@ -208,7 +208,7 @@ static u64 to_alsa_formats_mask(u64 sndif_formats) =20 mask =3D 0; for (i =3D 0; i < ARRAY_SIZE(ALSA_SNDIF_FORMATS); i++) - if (1 << ALSA_SNDIF_FORMATS[i].sndif & sndif_formats) + if (BIT_ULL(ALSA_SNDIF_FORMATS[i].sndif) & sndif_formats) mask |=3D pcm_format_to_bits(ALSA_SNDIF_FORMATS[i].alsa); =20 return mask; --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel