Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp881218rwb; Fri, 18 Nov 2022 09:26:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ZVI8BrOvlPOfk8yuCgxumvtsOcFAvWA6piI5VhX8+kcFrtkCzjNj83chRcdSNik7ahTe7 X-Received: by 2002:aa7:c7d5:0:b0:44e:bee5:4242 with SMTP id o21-20020aa7c7d5000000b0044ebee54242mr7057540eds.128.1668792391581; Fri, 18 Nov 2022 09:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668792391; cv=none; d=google.com; s=arc-20160816; b=p5yTqYLosKzcgukvhsgO5rvqAFcHzv+KCAXUeUPY+31pBR0IAHnv+xF53p4g9GWmAG UcAPGYoL1tX0rZ4PgUuoKTRRBzalIPNZACWuWv/hSsQ/0fee/jq3nt1LGMUdO099bHAB UPfZxHzPGJVXs1Ws+q0r/2eSPf4NKfjp5ld35HLYRcAkCS6tYDW1O/0EcNqvMnI2sK+u GO/ldLey44jU4zTQNXwsAtLC234sEoxvpryWHs8OkL1Q0OFwrdHDU9MglRcdYSi+ryZQ yZ//v1wLrUtDCDeIlKSvd4Rz/f5hSsv9V/gVBA7V3cvkaayWJ832ux+xowr5WKKO25SV 0Uew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:date:from:dkim-signature; bh=ehUyg9og+6g03rh9x9ts9jERlST9RZLtaqEmFDxKGMc=; b=dZJrAM1DsNcpgkHKelnicJeDG2m/QvcxSp73LNz265mZ1XOQvN/uVwYRkNkOayHht0 ncueaik1adm2VdaDKicSqGSIAWvwMyalziCTvbGlXIiJWVvmtNF0EFK3WEbEmQtc6Ai8 dXBgNXM0Z9yVeMN/pAI+aLXB6vAa4hpaL616zmUwhvzFkStTtgh3IJOCSYmsMj8NVwsh FBBVRrR+Y2KmsQxtkGVUIy6x1jrGJNqRS3+rqP5o9g3KjYYmwDsA5XWUohOgv/YHU53M TNQVgc/aY/HjNCTYRnUfitRdzi2g5e/U7CcuFVgVoBrNeBn48vmyi9C1O4H45UFn678g Dp0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=L35mCNVI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw16-20020a1709066a1000b0078232bfe3a0si3849758ejc.331.2022.11.18.09.26.07; Fri, 18 Nov 2022 09:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=L35mCNVI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235350AbiKRQtb (ORCPT + 90 others); Fri, 18 Nov 2022 11:49:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbiKRQt0 (ORCPT ); Fri, 18 Nov 2022 11:49:26 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D73CA93CC5 for ; Fri, 18 Nov 2022 08:49:25 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id c203so5375995pfc.11 for ; Fri, 18 Nov 2022 08:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :from:to:cc:subject:date:message-id:reply-to; bh=ehUyg9og+6g03rh9x9ts9jERlST9RZLtaqEmFDxKGMc=; b=L35mCNVIZNLiioNel/sW2fV4ieca4G2sXtR9lRBysm0PPqP3SFS0FLNmN8Pea7Zmbv tDwxDHIiDpeQ6gWL1H+yPvNjqinYeC71M4fdxdlOjiXQcofY6SpelDE6VqUFkvmHdGu9 WXTxrvdq6Su4POXtCphZuJDBBBKqzcEdSnJDI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ehUyg9og+6g03rh9x9ts9jERlST9RZLtaqEmFDxKGMc=; b=ocQRUGrbutw4bWNJPfmgIyUpj61qq4gXpmnGVTCVhoFPkXVuU+dbi2t4CR4itUDAtc j0BfYT8hJjcRkz+xLGj+fmIG/l87E/Dl6bn+xJqa4xtCobKe8VItqB2igibSK6jJdF76 u6ZrqQQEtkqlvXDY7VBaYfZb3AlI75RjeF3qKrsNqv6i97wUrNfdwjLLmozYR2dHSeVw GpcU0yi4QPmIJYrplNR8dDa2Wrd8Z3MkgmQBESdWVUr1H+NzKt6ob+wqZqV40IaUk+sr tmxG1p0wulqBqJff0SyFeR570QGVLp8Lf990wSqd/iYPJhbdYvYvyAa2VWAGtRo0eWmn uM4w== X-Gm-Message-State: ANoB5plLkKy9Y/XjZGTA83pOXXDKQn5rhxhjMfpYk9AwdltNerxjqGMc zF+/3THBF+J4ziGhOGoL0fKVWNc+JHLuUg== X-Received: by 2002:a63:f354:0:b0:476:db6f:e79d with SMTP id t20-20020a63f354000000b00476db6fe79dmr7426913pgj.399.1668790165373; Fri, 18 Nov 2022 08:49:25 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q4-20020a17090311c400b001865c298588sm3878961plh.258.2022.11.18.08.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 08:49:25 -0800 (PST) From: coverity-bot X-Google-Original-From: coverity-bot Date: Fri, 18 Nov 2022 08:49:24 -0800 To: Jani Nikula Cc: Jani Nikula , David Airlie , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Rodrigo Vivi , Lucas De Marchi , Joonas Lahtinen , intel-gfx@lists.freedesktop.org, Tvrtko Ursulin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Vetter , Arun R Murthy , Imre Deak , "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Coverity: intel_hti_uses_phy(): Integer handling issues Message-ID: <202211180848.D39006C@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20221118 as part of the linux-next scan project: https://scan.coverity.com/projects/linux-next-weekly-scan You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits: Thu Nov 17 16:12:56 2022 +0200 62749912540b ("drm/i915/display: move hti under display sub-struct") Coverity reported the following: *** CID 1527374: Integer handling issues (BAD_SHIFT) drivers/gpu/drm/i915/display/intel_hti.c:24 in intel_hti_uses_phy() 18 if (INTEL_INFO(i915)->display.has_hti) 19 i915->display.hti.state = intel_de_read(i915, HDPORT_STATE); 20 } 21 22 bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy) 23 { vvv CID 1527374: Integer handling issues (BAD_SHIFT) vvv In expression "1UL << 2 * phy + 1", shifting by a negative amount has undefined behavior. The shift amount, "2 * phy + 1", is as little as -1. 24 return i915->display.hti.state & HDPORT_ENABLED && 25 i915->display.hti.state & HDPORT_DDI_USED(phy); 26 } 27 28 u32 intel_hti_dpll_mask(struct drm_i915_private *i915) 29 { If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first): Reported-by: coverity-bot Addresses-Coverity-ID: 1527374 ("Integer handling issues") Fixes: 62749912540b ("drm/i915/display: move hti under display sub-struct") This code appears to be safe currently (intel_hti_uses_phy() is never called with PHY_NONE), but perhaps add an explicit check? if (WARN_ON(phy == PHY_NONE)) return false; Thanks for your attention! -- Coverity-bot