From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 04/17] drm: add object property type Date: Mon, 26 May 2014 10:33:04 +0200 Message-ID: <20140526083304.GY14357@phenom.ffwll.local> References: <1400956226-28053-1-git-send-email-robdclark@gmail.com> <1400956226-28053-5-git-send-email-robdclark@gmail.com> <20140526082947.GX14357@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by gabe.freedesktop.org (Postfix) with ESMTP id E82FD6E205 for ; Mon, 26 May 2014 01:33:08 -0700 (PDT) Received: by mail-we0-f181.google.com with SMTP id w61so7630374wes.40 for ; Mon, 26 May 2014 01:33:08 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140526082947.GX14357@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Rob Clark Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Mon, May 26, 2014 at 10:29:47AM +0200, Daniel Vetter wrote: > On Sat, May 24, 2014 at 02:30:13PM -0400, Rob Clark wrote: > > + } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { > > + /* a zero value for an object property translates to null: */ > > + if (value == 0) > > + return true; > > + return drm_property_get_obj(property, value) != NULL; > > Ok, so this usage is indeed safe for framebuffers since you only compare > the pointer against NULL. But you can't ever access this pointer since it > might disappear any time after you've dropped the idr lock. I think what > you actually want here is a new interface drm_mode_object_exists which > just returns a bool. > > That won't expose any risky things to callers and we can still keep the > restriction that calling drm_mode_object_get for framebuffers is a BUG. s/object_get/object_find/ I've meant ofc. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch