From: Damien Lespiau Subject: Re: [PATCH 09/11] drm/i915: Add rotation property for sprites Date: Wed, 18 Jun 2014 14:09:09 +0100 Message-ID: <20140618130909.GA29875@strange.amr.corp.intel.com> References: <1403081847-4364-1-git-send-email-sonika.jindal@intel.com> <1403081847-4364-10-git-send-email-sonika.jindal@intel.com> <20140618111251.GC18833@strange.amr.corp.intel.com> <53A17E10.5020908@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 9528A6E594 for ; Wed, 18 Jun 2014 06:09:25 -0700 (PDT) Content-Disposition: inline In-Reply-To: <53A17E10.5020908@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "Jindal, Sonika" Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, Jun 18, 2014 at 05:24:56PM +0530, Jindal, Sonika wrote: > >Shouldn't we add a: > > > > if (val & (BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_180))) > > return -EINVAL; > > > >To ensure userspace doesn't send garbage in the upper bits so we can > >reuse them down the road? > > > But we are checking if more than one bit is set, we return EINVAL. > So we only care for one rotation angle being sent from user. > Shouldn't that suffice? Nop. If given (1 << 50) we'd still pass the test but with an invalid (reserved) value. I didn't spot the generic drm_property_change_is_valid() (Ville's answer), so it should be handled for us by the DRM core already. All is fine. -- Damien