Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5108263imm; Tue, 12 Jun 2018 02:39:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKImj+nV1vCmcunL8Xr/uyCtvvDUCklIF81Ti2D0AWa47nS/KswDfJnTSlC9jdUoxvscLfGv X-Received: by 2002:a62:10c2:: with SMTP id 63-v6mr3015808pfq.229.1528796380259; Tue, 12 Jun 2018 02:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528796380; cv=none; d=google.com; s=arc-20160816; b=0n0CMpAkCE1ytVnC/71lnDaUOaQR8wxPrW/VUihw/U/28YiT2wjV1Nu7q6rOTVcPbK NkTAVM/qxAicvD9oaIRPwoGXo3MM28BtZdA4r98aC02ZGSJ8x4XVHwbJ/icNdJqhKgqF ilZinHLbhJeEOXh1GoSKqXl2EH/eaqE3GI8iFddSkRhjWPb3Rn/b6+ikmV1aextiQ90d OxF1u8ttAU2crWh6NIbHP/YzVAlCHrikQU2eu/e7kl9otf9YmjZhlPHrc+FYh+G+8oLk VU5pMSM+DaODl3CD18vk5j0DIOPGD5nKADHdQJq7ILEW15F4wF/fphuT4EIYnka6h/S3 7Vrg== 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 :message-id:date:subject:cc:to:from:arc-authentication-results; bh=qUHHAY3U+C3MeNljtRUCiu4xo30muSVo80Qn4391z/o=; b=KFRa8EF6xWx6JfsCllJkc8Q1EhADejnmRw3+uo1T9VRyLzbnhWCIutbBaxQFYCl752 zw1HBk0Ulc6VFmUYRN++V+keYXocj6zjYKC+4xI7W38vK7E4OFRj0/rKJ5m/bT+X5HUD VDPeIqZDLceznTDYs5EoSRa6xMKSf63aid4P+b5rTud6UNsaDJPrDtcgApbmB6jszl0Y OmgRHOtxbP64OMmzk9w6fRKTnYlUX6DW13upmFYuIG8PsnOeQbXQKiVaEYbQ0GVCPK63 BpNCf86nSyVJ16+jT1yaGwQSgjSufaWU1mv3RY/9+XMLRTGVRZkWG+c8uTYaIj1eeMSp h8zA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si496498plb.90.2018.06.12.02.39.25; Tue, 12 Jun 2018 02:39:40 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754314AbeFLJiM (ORCPT + 99 others); Tue, 12 Jun 2018 05:38:12 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:34601 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754182AbeFLJiL (ORCPT ); Tue, 12 Jun 2018 05:38:11 -0400 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 1fSfkb-0006T6-3V; Tue, 12 Jun 2018 09:38:05 +0000 From: Colin King To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][V3] drm/i915/guc: fix GEM_BUG_ON check Date: Tue, 12 Jun 2018 10:38:04 +0100 Message-Id: <20180612093804.11341-1-colin.king@canonical.com> X-Mailer: git-send-email 2.17.0 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 The check for level being less than zero always false because flags is currently unsigned and can never be negative. Fix this by making level a s32. Detected by CoverityScan, CID#1468363 ("Macro compares unsigned to 0") Fixes: cb5d64e9f13e ("drm/i915/guc: Allow user to control default GuC logging") Signed-off-by: Colin Ian King --- V3: Make level s32 and add the missing Fixes: tag, thanks to Dan Carpenter and Jani Nikula for correcting my mistakes --- drivers/gpu/drm/i915/intel_guc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c index 116f4ccf1bbd..bdb1fab322bf 100644 --- a/drivers/gpu/drm/i915/intel_guc.c +++ b/drivers/gpu/drm/i915/intel_guc.c @@ -205,7 +205,7 @@ void intel_guc_fini(struct intel_guc *guc) static u32 get_log_control_flags(void) { - u32 level = i915_modparams.guc_log_level; + s32 level = i915_modparams.guc_log_level; u32 flags = 0; GEM_BUG_ON(level < 0); -- 2.17.0