All of lore.kernel.org
 help / color / mirror / Atom feed
From: 김승우 <sw0312.kim@samsung.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	dri-devel@lists.freedesktop.org, airlied@linux.ie,
	kyungmin.park@samsung.com, yj44.cho@samsung.com,
	Seung-Woo Kim <sw0312.kim@samsung.com>
Subject: Re: [PATCH v2] drm/gem: fix not to assign error value to gem name
Date: Fri, 28 Jun 2013 13:15:43 +0900	[thread overview]
Message-ID: <51CD0DEF.2010000@samsung.com> (raw)
In-Reply-To: <20130627083100.GB24932@cantiga.alporthouse.com>

Hello, Chris,

On 2013년 06월 27일 17:31, Chris Wilson wrote:
> On Thu, Jun 27, 2013 at 08:58:33AM +0900, Seung-Woo Kim wrote:
>> From: YoungJun Cho <yj44.cho@samsung.com>
>>
>> If idr_alloc() is failed, obj->name can be error value. Also
>> it cleans up duplicated flink processing code.
>>
>> This regression has been introduced in
>>
>> commit 2e928815c1886fe628ed54623aa98d0889cf5509
>> Author: Tejun Heo <tj@kernel.org>
>> Date:   Wed Feb 27 17:04:08 2013 -0800
>>
>>     drm: convert to idr_alloc()
>>
>> Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> 
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Minor comment inline.
> 
>> ---
>> change since v1:
>> - Add a regression commit information in commit msg as Chris commented
>>
>>  drivers/gpu/drm/drm_gem.c |   18 +++++++-----------
>>  1 file changed, 7 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
>> index 4321713..c9d7081 100644
>> --- a/drivers/gpu/drm/drm_gem.c
>> +++ b/drivers/gpu/drm/drm_gem.c
>> @@ -453,25 +453,21 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
>>  	spin_lock(&dev->object_name_lock);
>>  	if (!obj->name) {
>>  		ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_NOWAIT);
>> -		obj->name = ret;
>> -		args->name = (uint64_t) obj->name;
>> -		spin_unlock(&dev->object_name_lock);
>> -		idr_preload_end();
>> -
>>  		if (ret < 0)
>>  			goto err;
> 
> Being pedantic, ret == 0 is also an error - but a programming error
> leading to an object leak. BUG_ON(ret == 0) ?
> -Chris
> 

It seems that idr_alloc() with start id 1 does not return 0, so IMHO,
ret == 0 can be ignored here.

But if you think it needs to consider programming error, I'll add some
assertion. Please let me know.

Thanks and Regards,
- Seung-Woo Kim

-- 
Seung-Woo Kim
Samsung Software R&D Center
--

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2013-06-28  4:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26  1:42 [PATCH] drm/gem: fix not to assign error value to gem name Seung-Woo Kim
2013-06-26  8:55 ` Chris Wilson
2013-06-26  9:07   ` YoungJun Cho
2013-06-26 23:58   ` [PATCH v2] " Seung-Woo Kim
2013-06-27  8:31     ` Chris Wilson
2013-06-28  4:15       ` 김승우 [this message]
2013-06-28  8:08         ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51CD0DEF.2010000@samsung.com \
    --to=sw0312.kim@samsung.com \
    --cc=airlied@linux.ie \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kyungmin.park@samsung.com \
    --cc=yj44.cho@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.