From patchwork Thu Aug 16 08:29:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Bornecrantz X-Patchwork-Id: 1330371 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 64B4EDF280 for ; Thu, 16 Aug 2012 08:47:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6ABFAA0E28 for ; Thu, 16 Aug 2012 01:47:20 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by gabe.freedesktop.org (Postfix) with ESMTP id A89E8A0DA4 for ; Thu, 16 Aug 2012 01:47:10 -0700 (PDT) Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 85550284F6 for ; Thu, 16 Aug 2012 01:47:09 -0700 (PDT) Received: from zimbra-prod-ext-mta-2.vmware.com (zimbra-prod-ext-mta-2.vmware.com [10.113.62.212]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id CB57218667 for ; Thu, 16 Aug 2012 01:29:20 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id C4063100034 for ; Thu, 16 Aug 2012 01:29:20 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra-prod-ext-mta-2.vmware.com Received: from zimbra-prod-ext-mta-2.vmware.com ([127.0.0.1]) by localhost (zimbra-prod-ext-mta-2.vmware.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JgaGD2Uxldl1 for ; Thu, 16 Aug 2012 01:29:20 -0700 (PDT) Received: from localhost.localdomain (unknown [10.113.62.14]) by zimbra-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA id 13D84100033 for ; Thu, 16 Aug 2012 01:29:19 -0700 (PDT) From: Jakob Bornecrantz To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: Check for invalid cursor flags Date: Thu, 16 Aug 2012 10:29:03 +0200 Message-Id: <1345105743-32136-1-git-send-email-jakob@vmware.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Signed-off-by: Jakob Bornecrantz --- drivers/gpu/drm/drm_crtc.c | 2 +- include/drm/drm_mode.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 08a7aa7..6fbfc24 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1981,7 +1981,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; - if (!req->flags) + if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags)) return -EINVAL; mutex_lock(&dev->mode_config.mutex); diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 5581980..3d6301b 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -359,8 +359,9 @@ struct drm_mode_mode_cmd { struct drm_mode_modeinfo mode; }; -#define DRM_MODE_CURSOR_BO (1<<0) -#define DRM_MODE_CURSOR_MOVE (1<<1) +#define DRM_MODE_CURSOR_BO 0x01 +#define DRM_MODE_CURSOR_MOVE 0x02 +#define DRM_MODE_CURSOR_FLAGS 0x03 /* * depending on the value in flags different members are used.