[PATCH] drm: fix blob pointer check

Lionel Landwerlin lionel.g.landwerlin at intel.com
Thu Mar 10 12:04:21 UTC 2016


Check properly that the allocated blob's pointer is valid.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Cc: Daniel Stone <daniels at collabora.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Matt Roper <matthew.d.roper at intel.com>
Cc: dri-devel at lists.freedesktop.org
---
 drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 87d0b20..1caddb1 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2917,8 +2917,8 @@ void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
 	blob = drm_property_create_blob(dev,
 					sizeof(struct drm_color_lut) * size,
 					NULL);
-	if (!blob) {
-		ret = -ENOMEM;
+	if (IS_ERR(blob)) {
+		ret = PTR_ERR(blob);
 		goto fail;
 	}
 
-- 
2.7.0



More information about the dri-devel mailing list