Re: [PATCH 2/5] drm/i915: Use kcalloc more

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 19 Sep 2013, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> On Thu, Sep 19, 2013 at 01:38:18PM +0300, Jani Nikula wrote:
>> On Thu, 19 Sep 2013, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote:
>> > diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
>> > index c38d575..763283e 100644
>> > --- a/drivers/gpu/drm/i915/i915_gpu_error.c
>> > +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
>> > @@ -791,7 +791,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
>> >  
>> >  		error->ring[i].num_requests = count;
>> >  		error->ring[i].requests =
>> > -			kmalloc(count*sizeof(struct drm_i915_error_request),
>> > +			kcalloc(count, sizeof(error->ring[i].requests),
>> 
>> Crash boom bang.
>
> Not quite. This is evaluated at compile time by parsing the type rather
> than by pointer dereference.

Sizeof changes from sizeof(struct drm_i915_error_request) to
sizeof(struct drm_i915_error_request *). It'll break something. Maybe
not as spectacularly as I was implying.

Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux