Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp575275img; Fri, 22 Mar 2019 04:21:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG2G0Plf/lIWgxwWyZVVd2kqPlLvj5qLNeYYsR0qz2DkGaOFIgGGf53mXjHXPRNgBuyIA7 X-Received: by 2002:a63:7503:: with SMTP id q3mr7772598pgc.98.1553253690465; Fri, 22 Mar 2019 04:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253690; cv=none; d=google.com; s=arc-20160816; b=xyzmsitDbGrUHC9sGZTY4nfyac/QFRg1CEipcyLoXaHOHJDi2p04ONct7M3h6V8WB3 WzVfvBSn4lbPOvFv49i4xuLZdiy25hYI08ywmd9ZbHoVrnKzZk2W66zpIl3FxMaSjCSC lmNZZVBrJu8sN85KNGjLZtzW/B7eQeFYZorEG2puJshhOtp0A5OmtsfjWpzAScsmIFvI dNlztQ4Vn7/2nsFw9v7D6W5BVey3jVT9/ExWp2PbqbJA7BVJYJ97ogWAlpLqpoSrl7Ep 6FzaHx8mEnl9+bfmYcVlqXdAzZX/M4nZ2HLgxK1dUNuxyYxcUxKQZYbwqdpkzlLB/eqW MKXA== 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=3fmq9nC+OfKMZlinkiFRa2EACoVdkcTkfIB2045YfiM=; b=lz+Ikf61ALx/falPfZz8AgDRUO8BCnrl3KhY1VBZWkyVCJxQqSdd2XpK02nkG3ILbl XoGH+H9NVjNsOWIkpsN7DO81KhdHS4+1nYN4bMmCDt0ELuEk1o8n41JDIiEAC0Inol0k 8HEo5veRIFh2PWY0tmvSw+d0MEa46j75bfAFN3TvcEv0wHpI9SoiNaNlzdXXYAIjkdZ0 ZpxYH8XTM6c8qO7spSA32EtsZNCcahvwNe5aww89WoLMk3bKTRljKcIwrDe6tqteoqHu GyqJmACLB3YPD1xs1FK//iQDE45mxituZEb9tGN5RE0VT3Uf/KilknVjS3sY45aojBnY rlCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M2lxRQv0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si6766517pls.231.2019.03.22.04.21.15; Fri, 22 Mar 2019 04:21:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M2lxRQv0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728304AbfCVLUP (ORCPT + 99 others); Fri, 22 Mar 2019 07:20:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:46322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728236AbfCVLTv (ORCPT ); Fri, 22 Mar 2019 07:19:51 -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 A96F5218A2; Fri, 22 Mar 2019 11:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253591; bh=1nyKJ0iNx/0QYhmKvE+tO4riQz98k5/A/nZZNhOychI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M2lxRQv0PV3MtW6snyW7MyPR5KFxxS4kWmVlCFo7hgLciC/TEiHtmMZHJOLB4/dlr v/0eCvHQHPk8sxDGGl/gWli5aZZrF2UiA1G/HGK7sMyFDJ6cINKrtWKYhf+SYxf2D6 k2bmV5QJU5ojCTAcktkqT71mi6hdLsAxnOyMRkRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , "David S. Miller" , Sasha Levin Subject: [PATCH 3.18 015/134] atm: he: fix sign-extension overflow on large shift Date: Fri, 22 Mar 2019 12:13:48 +0100 Message-Id: <20190322111211.142913103@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit cb12d72b27a6f41325ae23a11033cf5fedfa1b97 ] Shifting the 1 by exp by an int can lead to sign-extension overlow when exp is 31 since 1 is an signed int and sign-extending this result to an unsigned long long will set the upper 32 bits. Fix this by shifting an unsigned long. Detected by cppcheck: (warning) Shifting signed 32-bit value by 31 bits is undefined behaviour Signed-off-by: Colin Ian King Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/atm/he.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/he.c b/drivers/atm/he.c index c39702bc279d4..937f54ccbe6b5 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -717,7 +717,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev) instead of '/ 512', use '>> 9' to prevent a call to divdu3 on x86 platforms */ - rate_cps = (unsigned long long) (1 << exp) * (man + 512) >> 9; + rate_cps = (unsigned long long) (1UL << exp) * (man + 512) >> 9; if (rate_cps < 10) rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ -- 2.19.1