Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2641158pxa; Mon, 17 Aug 2020 15:13:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRHsN7f289hAGSUOXt377dpm4hgXUiq7rQurogaWaul9CqnymF/Zd18kZdIexurLB7IeLZ X-Received: by 2002:a17:906:8316:: with SMTP id j22mr16553803ejx.20.1597702422512; Mon, 17 Aug 2020 15:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597702422; cv=none; d=google.com; s=arc-20160816; b=q5I5FRO7qKgZnuRDHhh8twqH8xUjqOMitSvQHE/ddNb1rybfVqikvhGvzTDYFH7Mlh ybE3NzcncIutFfLTbfCzts1WcTE03Wq7t8FIkZ7MSxdBLKaWUsXV9Av4Ev4BVWanww3Z sunOuK9upMqWrnNn9n7Yu0LymIZGrsKDz7ocKXBvKPQTHAppCtrdnZ8Ouu/NQorTC55b OGMl7ambgYfiKXs+t2Qxttf80yEb1ZOh7ukImHexoxmeodYVP3Sgq6NoQVx94050q06g tyAJ7tyZ5wr8uLob/91ibyuT5ZOklbMeVPInSWD4X4GnVLjeG2vtJqnRa4PJJLepfHM1 3hgg== 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=0yfNO+O5zZzU1DfikTI1LWzqTq9ufP0CcWhpYi+RbAI=; b=wNZZvFDEFQB/rVNwQNa33hXb3MIQ8hluVJz375fUiTHuHSwNehiCvKw8bEj/jNJChz anGlghuRbdcgGOwx5T1QXi5FhEdyZcFuypCiBeOU6fRX3IwVglJfuqy1K9J1V9bsGRuZ 4xrxC8j80F1uWQ3VRUx27qND9120BrJ8IbIkVlls1jtNJE2Sja56yZV1iqz1YYxWLWu5 CEjcHbXei4MB5qZ3S1hMpabFad3s+fBLoat37Tvgl4a5ybP4S2CF+ii1/Cj9x/1tCEK4 hGz9Ghriwf+INuNTDhziEoHgtyGCI+ktPR1hYoFFlAeG1Jn3nQlYlFwkm59TJehq/PN+ SB7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IlT3Tlqs; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si13172813edn.359.2020.08.17.15.13.18; Mon, 17 Aug 2020 15:13:42 -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=IlT3Tlqs; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389160AbgHQQzJ (ORCPT + 99 others); Mon, 17 Aug 2020 12:55:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:51518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388260AbgHQQDs (ORCPT ); Mon, 17 Aug 2020 12:03:48 -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 BE50B20748; Mon, 17 Aug 2020 16:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680228; bh=dDHCttxOlMfqErKZolfL4n9zuGTiz1whoW+rGBbmAR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IlT3TlqsmFFzgIFVxgy1dajNwQOq/A0qHCBPU5rupZc1+OwGH0DXl2bAUMWULZmpO kz5F5O27X5LvwGrJyCmAQGwJDxh++LMEgdg3Tsf2689ANOqu1r5pYewK71P+hRTxxf bFEL1kYTqasGtsOew5ImzKS3BXhY78pH1vBaQBm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Liviu Dudau , Liviu Dudau , Sasha Levin Subject: [PATCH 5.4 103/270] drm/arm: fix unintentional integer overflow on left shift Date: Mon, 17 Aug 2020 17:15:04 +0200 Message-Id: <20200817143800.911478782@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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: Colin Ian King [ Upstream commit 5f368ddea6fec519bdb93b5368f6a844b6ea27a6 ] Shifting the integer value 1 is evaluated using 32-bit arithmetic and then used in an expression that expects a long value leads to a potential integer overflow. Fix this by using the BIT macro to perform the shift to avoid the overflow. Addresses-Coverity: ("Unintentional integer overflow") Fixes: ad49f8602fe8 ("drm/arm: Add support for Mali Display Processors") Signed-off-by: Colin Ian King Acked-by: Liviu Dudau Signed-off-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20200618100400.11464-1-colin.king@canonical.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/arm/malidp_planes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c index 3c70a53813bf2..0b2bb485d9be3 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -928,7 +928,7 @@ int malidp_de_planes_init(struct drm_device *drm) const struct malidp_hw_regmap *map = &malidp->dev->hw->map; struct malidp_plane *plane = NULL; enum drm_plane_type plane_type; - unsigned long crtcs = 1 << drm->mode_config.num_crtc; + unsigned long crtcs = BIT(drm->mode_config.num_crtc); unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | -- 2.25.1