Message ID | 1479488536-6168-1-git-send-email-matthew.auld@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Nov 18, 2016 at 05:02:16PM +0000, Matthew Auld wrote: > When gathering the pages from our backing storage we expect get_pages() > to either give us our sg_table or an err ptr. However when gathering our > fake pages for stolen memory we may return NULL in the event of a > failure. To prevent any funny business we should therefore return the > proper err ptr value. > > Fixes: 03ac84f1830e ("drm/i915: Pass around sg_table to get_pages/put_pages backend") > Cc: Chris Wilson <chris@chris-wilson.co.uk> > Signed-off-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Please have a look at https://patchwork.freedesktop.org/series/15267/ -Chris
On Fri, Nov 18, 2016 at 05:08:55PM +0000, Chris Wilson wrote: > On Fri, Nov 18, 2016 at 05:02:16PM +0000, Matthew Auld wrote: > > When gathering the pages from our backing storage we expect get_pages() > > to either give us our sg_table or an err ptr. However when gathering our > > fake pages for stolen memory we may return NULL in the event of a > > failure. To prevent any funny business we should therefore return the > > proper err ptr value. > > > > Fixes: 03ac84f1830e ("drm/i915: Pass around sg_table to get_pages/put_pages backend") > > Cc: Chris Wilson <chris@chris-wilson.co.uk> > > Signed-off-by: Matthew Auld <matthew.auld@intel.com> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> And pushed, thanks for the patch. -Chris
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 5bc9f699fdd2..ebaa941c83af 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -525,11 +525,11 @@ i915_pages_create_for_stolen(struct drm_device *dev, st = kmalloc(sizeof(*st), GFP_KERNEL); if (st == NULL) - return NULL; + return ERR_PTR(-ENOMEM); if (sg_alloc_table(st, 1, GFP_KERNEL)) { kfree(st); - return NULL; + return ERR_PTR(-ENOMEM); } sg = st->sgl;
When gathering the pages from our backing storage we expect get_pages() to either give us our sg_table or an err ptr. However when gathering our fake pages for stolen memory we may return NULL in the event of a failure. To prevent any funny business we should therefore return the proper err ptr value. Fixes: 03ac84f1830e ("drm/i915: Pass around sg_table to get_pages/put_pages backend") Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Matthew Auld <matthew.auld@intel.com> --- drivers/gpu/drm/i915/i915_gem_stolen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)