From patchwork Mon Nov 11 17:25:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 11237401 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA5C717E6 for ; Mon, 11 Nov 2019 17:49:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A182620818 for ; Mon, 11 Nov 2019 17:49:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A182620818 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=embeddedor.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C3AA6E9A4; Mon, 11 Nov 2019 17:49:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1436 seconds by postgrey-1.36 at gabe; Mon, 11 Nov 2019 17:49:32 UTC Received: from gateway32.websitewelcome.com (gateway32.websitewelcome.com [192.185.145.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A7C06E9A4 for ; Mon, 11 Nov 2019 17:49:32 +0000 (UTC) Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 9BCDFB7FCB for ; Mon, 11 Nov 2019 11:25:35 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id UDRXi4xTVqNtvUDRXiu2TH; Mon, 11 Nov 2019 11:25:35 -0600 X-Authority-Reason: nr=8 Received: from [187.192.2.30] (port=45762 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.92) (envelope-from ) id 1iUDRU-001CZi-Un; Mon, 11 Nov 2019 11:25:33 -0600 Date: Mon, 11 Nov 2019 11:25:43 -0600 From: "Gustavo A. R. Silva" To: Harry Wentland , Leo Li , Alex Deucher , Christian =?iso-8859-1?q?K=F6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Mikita Lipski , Lyude Paul , Nicholas Kazlauskas Subject: [PATCH] drm/amd/display: Fix unsigned variable compared to less than zero Message-ID: <20191111172543.GA31748@embeddedor> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - lists.freedesktop.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 187.192.2.30 X-Source-L: No X-Exim-ID: 1iUDRU-001CZi-Un X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [187.192.2.30]:45762 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 12 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Type:MIME-Version:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=obJGNctpNomw0ORl8GMTnOXHVQTOW6QwMfGlRbchZDQ=; b=viQc/KpkyqpjaooaNayckCTFw5 jPT+0IfyxeHPWb8eVLnXjU0UNzYGM+p0EvVAX8Ex1+EUwP1W+zbACBcdlQaS8+bCFJnU7q1PjsXXu bC0NPhCyZxaLPIp76IzUT8B2V/swRFzeHxsKtalaVs43Pc8DQ+vNNE1B+cJA78YL3wZ6fl9fZegLg n4/aIk6NZOtbzzNEKxJad2pCp/locExG7MJulTuSwcfXn/84kPBCbUQGwylAdhgCNHGmU9h4XCBqs Br+CFXHcgMvh2BTDHzYfbkhfWPE8MP1uDDjm0hnx5Tltn0FYqZ7SvKEb7Peel/MPrZ9EbCzSs3rHL giAKWVQg==; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gustavo A. R. Silva" , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currenly, the error check below on variable *vcpi_slots* is always false because it is a uint64_t type variable, hence, the values this variable can hold are never less than zero: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c: 4870 if (dm_new_connector_state->vcpi_slots < 0) { 4871 DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_stat e->vcpi_slots); 4872 return dm_new_connector_state->vcpi_slots; 4873 } Fix this by making *vcpi_slots* of int type. Addresses-Coverity: 1487838 ("Unsigned compared against 0") Fixes: b4c578f08378 ("drm/amd/display: Add MST atomic routines") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 6db07e9e33ab..a8fc90a927d6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -403,7 +403,7 @@ struct dm_connector_state { bool underscan_enable; bool freesync_capable; uint8_t abm_level; - uint64_t vcpi_slots; + int vcpi_slots; uint64_t pbn; };