Skip to contentSkip to conversation

drm/xen-front: Fix error code in xen_drm_front_gem_get_sg_table()

PATCH In review Dan Carpenter 2 participants 9 messages Jul 19, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xen-front: Fix error code in xen_drm_front_gem_get_sg_table()

The xen_drm_front_gem_get_sg_table() function is supposed to return error pointer. The current code, would trigger a NULL dereference in drm_gem_map_dma_buf().

Fixes c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
drivers/gpu/drm/xen/xen_drm_front_gem.c +1 -1
index c85bfe7571cb..4507bc03ed8f 100644
@@ -179,7 +179,7 @@ struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj)
 	struct xen_gem_object *xen_obj = to_xen_gem_obj(gem_obj);
 
 	if (!xen_obj->pages)
-		return NULL;
+		return ERR_PTR(-EINVAL);
 
 	return drm_prime_pages_to_sg(xen_obj->pages, xen_obj->num_pages);
 }
#1 lore raw

Hi, Dan!

Thank you for the patch and sorry I was clumsy sending v3.

Do you want me to send v3 now with the fixes for both Xen and CMA?

Thank you,

Oleksandr

Quoted 20 lines · Dan Carpenter

The xen_drm_front_gem_get_sg_table() function is supposed to return error pointer. The current code, would trigger a NULL dereference in drm_gem_map_dma_buf().

Fixes c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
drivers/gpu/drm/xen/xen_drm_front_gem.c +1 -1
index c85bfe7571cb..4507bc03ed8f 100644
@@ -179,7 +179,7 @@ struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj)
  	struct xen_gem_object *xen_obj = to_xen_gem_obj(gem_obj);
 
  	if (!xen_obj->pages)
-		return NULL;
+		return ERR_PTR(-EINVAL);
 
  	return drm_prime_pages_to_sg(xen_obj->pages, xen_obj->num_pages);
  }
#6 lore raw
In reply to Dan Carpenter

Hi, Dan!

Thank you for the patch and sorry I was clumsy sending v3.

Do you want me to send v3 now with the fixes for both Xen and CMA?

Thank you,

Oleksandr

Quoted 12 lines · Dan Carpenter

The xen_drm_front_gem_get_sg_table() function is supposed to return error pointer. The current code, would trigger a NULL dereference in drm_gem_map_dma_buf().

Fixes c575b7eeb89f ("drm/xen-front: Add support for Xen PV display frontend")
drivers/gpu/drm/xen/xen_drm_front_gem.c +0 -0
index c85bfe7571cb..4507bc03ed8f 100644

drivers/gpu/drm/xen/xen_drm_front_gem.c struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj) · line 185

Quoted 8 lines
drivers/gpu/drm/xen/xen_drm_front_gem.c +1 -1
@@ -179,7 +179,7 @@ struct sg_table *xen_drm_front_gem_get_sg_table(struct drm_gem_object *gem_obj)
  	struct xen_gem_object *xen_obj = to_xen_gem_obj(gem_obj);
 
  	if (!xen_obj->pages)
-		return NULL;
+		return ERR_PTR(-EINVAL);
 
  	return drm_prime_pages_to_sg(xen_obj->pages, xen_obj->num_pages);
  }

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Oleksandr Andrushchenko
Quoted 7 lines · Oleksandr Andrushchenko

Hi, Dan!

Thank you for the patch and sorry I was clumsy sending v3.

Do you want me to send v3 now with the fixes for both Xen and CMA?

Thank you,

Sorry, I forgot that you had sent these earlier. After a while these things all look the same. I once accidentally wrote and sent the same patch three times without realizing.

Yeah. Please resend a v3.

regards,
dan carpenter

#5 lore raw
In reply to Oleksandr Andrushchenko
Quoted 7 lines · Oleksandr Andrushchenko

Hi, Dan!

Thank you for the patch and sorry I was clumsy sending v3.

Do you want me to send v3 now with the fixes for both Xen and CMA?

Thank you,

Sorry, I forgot that you had sent these earlier. After a while these things all look the same. I once accidentally wrote and sent the same patch three times without realizing.

Yeah. Please resend a v3.

regards,
dan carpenter

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Dan Carpenter
Quoted 7 lines · Oleksandr Andrushchenko

Hi, Dan!

Thank you for the patch and sorry I was clumsy sending v3.

Do you want me to send v3 now with the fixes for both Xen and CMA?

Thank you,

Sorry, I forgot that you had sent these earlier. After a while these things all look the same. I once accidentally wrote and sent the same patch three times without realizing.

np

Quoted 1 line

Yeah. Please resend a v3.

sure

Quoted 3 lines

regards,
dan carpenter

#4 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Dan Carpenter
Quoted 7 lines · Oleksandr Andrushchenko

Hi, Dan!

Thank you for the patch and sorry I was clumsy sending v3.

Do you want me to send v3 now with the fixes for both Xen and CMA?

Thank you,

Sorry, I forgot that you had sent these earlier. After a while these things all look the same. I once accidentally wrote and sent the same patch three times without realizing.

np

Quoted 1 line

Yeah. Please resend a v3.

sure

Quoted 3 lines

regards,
dan carpenter

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel