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

Chris Wilson
2013-09-19T10:50:20Z

On Thu, Sep 19, 2013 at 01:38:18PM +0300, Jani Nikula wrote:
> On Thu, 19 Sep 2013, Daniel Vetter <daniel.vetter@ffwll.ch> 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.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre