From patchwork Sun Dec 7 21:26:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 5453571 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D062FBEEBA for ; Mon, 8 Dec 2014 00:50:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0790C20155 for ; Mon, 8 Dec 2014 00:50:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D597D2012E for ; Mon, 8 Dec 2014 00:50:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 556CB6E44C; Sun, 7 Dec 2014 16:50:04 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by gabe.freedesktop.org (Postfix) with ESMTP id D8BDB6E0EC for ; Sun, 7 Dec 2014 13:26:46 -0800 (PST) Received: by mail-lb0-f179.google.com with SMTP id z11so2840948lbi.10 for ; Sun, 07 Dec 2014 13:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=CFuYSLcFORzIRoGv8cM9ffKzVX9sj7vKkCp5rY32d2M=; b=LcT+mK4UCoMELXMHs+0Z9TJ5sDb+cVG4IaNUrIW0ym8k38lNlgl8IAU0TaMFACrRCv V9uIetzoPQSzkLGLfUAc3wZ0VWNfJ8D+T12Bzeqz/UnBmGJbXipvDAi/7g2+1tYATgM0 jJnmQ+Bkf5gQgaRQsyA9BzBaf2iQNt3rghJTc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CFuYSLcFORzIRoGv8cM9ffKzVX9sj7vKkCp5rY32d2M=; b=BbfPejzqd6yBLdTGx/bYxCux/A0O+vUhpaGsiU1vEYrGOGJP8+78v3e/pjbfviROUM qspKwHwBZUPVqOxSSS9fpki8mN0GDkLxmkzMGO9CfJIshR7XwbWqW156TxeP/9P3l3HV 3/iRH6SfR7ICf6nHiLKFbmdnLEYZ5VWYM7UvLFLYab6/hN0pQFcLxTzvb3Na86aaY1ac mcx4JAxrMt3YsdngJjHJp3TdU/g1ONWV005468F7GOpbOfab2ZrhMG12zJLqzWq/+gG+ NWRT3nAwgwFmdZWTFCV9EL3lpbeLqR083sM3mHUBbOBNRh+UJWn/tCv0/pBtKQ3WCYmY tBzw== X-Gm-Message-State: ALoCoQlsKCQH51cyLhpSt1D6fW/ZBaryM9T89D7ZTcRShn3SCYf5MW4ywOn6QrLTPzTnfEsTyxqn X-Received: by 10.152.88.69 with SMTP id be5mr13458789lab.36.1417987605380; Sun, 07 Dec 2014 13:26:45 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id j2sm7667156lbs.3.2014.12.07.13.26.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Dec 2014 13:26:44 -0800 (PST) From: Rasmus Villemoes To: Daniel Vetter , Jani Nikula , David Airlie Subject: [PATCH] drm/i915: Fix comparison bug Date: Sun, 7 Dec 2014 22:26:27 +0100 Message-Id: <1417987587-7240-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 X-Mailman-Approved-At: Sun, 07 Dec 2014 16:50:00 -0800 Cc: intel-gfx@lists.freedesktop.org, Rasmus Villemoes , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ->stolen->start has type unsigned long; relying on the difference (effectively cast to int) for sorting is wrong. Signed-off-by: Rasmus Villemoes --- drivers/gpu/drm/i915/i915_debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 063b44817e08..adfb863bb580 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -236,7 +236,11 @@ static int obj_rank_by_stolen(void *priv, struct drm_i915_gem_object *b = container_of(B, struct drm_i915_gem_object, obj_exec_link); - return a->stolen->start - b->stolen->start; + if (a->stolen->start < b->stolen->start) + return -1; + if (a->stolen->start > b->stolen->start) + return 1; + return 0; } static int i915_gem_stolen_list_info(struct seq_file *m, void *data)