[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_NZa=-_Cs6zq=0kk-A9VKa=56Sbg+dUrgdvB5vz77SAnw@mail.gmail.com>
Date: Fri, 29 Jun 2018 10:50:15 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Michel Dänzer <michel@...nzer.net>
Cc: Gustavo Padovan <gustavo@...ovan.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Sean Paul <seanpaul@...omium.org>,
David Airlie <airlied@...ux.ie>,
LKML <linux-kernel@...r.kernel.org>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH] drm: Use kvzalloc for allocating blob property memory
On Fri, Jun 29, 2018 at 10:27 AM, Michel Dänzer <michel@...nzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@....com>
>
> The property size may be controlled by userspace, can be large (I've
> seen failure with order 4, i.e. 16 pages / 64 KB) and doesn't need to be
> physically contiguous.
>
> Signed-off-by: Michel Dänzer <michel.daenzer@....com>
Reviewed-by: Alex Deucher <alexander.deucher@....com>
> ---
> drivers/gpu/drm/drm_property.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index 1f8031e30f53..cdb10f885a4f 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -532,7 +532,7 @@ static void drm_property_free_blob(struct kref *kref)
>
> drm_mode_object_unregister(blob->dev, &blob->base);
>
> - kfree(blob);
> + kvfree(blob);
> }
>
> /**
> @@ -559,7 +559,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
> if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
> return ERR_PTR(-EINVAL);
>
> - blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
> + blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
> if (!blob)
> return ERR_PTR(-ENOMEM);
>
> @@ -576,7 +576,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
> ret = __drm_mode_object_add(dev, &blob->base, DRM_MODE_OBJECT_BLOB,
> true, drm_property_free_blob);
> if (ret) {
> - kfree(blob);
> + kvfree(blob);
> return ERR_PTR(-EINVAL);
> }
>
> --
> 2.18.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists