automake: set --enable-valgrind during make distcheck
PATCH 1/2 automake: set --enable-valgrind during make distcheck
--- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile.am +2 -1
@@ -37,7 +37,8 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ --enable-tegra-experimental-api \ --enable-install-test-programs \ --enable-cairo-tests \ - --enable-manpages + --enable-manpages \ + --enable-valgrind pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm.pc
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 xf86drmMode: smoke-test the atomic API
As going through the modetest patches for atomic support I've noticed that if we pass NULL for the drmModeAtomicReqPtr argument we'll crash.
So let's handle things appropriately if the user forgot to check the return value of drmModeAtomicAlloc and drmModeAtomicDuplicate or made a typo somewhere along the way.
--- xf86drmMode.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
xf86drmMode.c +16 -1
@@ -1189,6 +1189,9 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old) {drmModeAtomicReqPtr new; +if (!old) +return NULL ; + new =drmMalloc (sizeof *new);if (!new)return NULL ;
@@ -1213,6 +1216,9 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)int drmModeAtomicMerge (drmModeAtomicReqPtr base,drmModeAtomicReqPtr augment) { +if (!base) +return -EINVAL ; +if (!augment || augment->cursor ==0 )return 0 ;
@@ -1239,12 +1245,15 @@ int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment)int drmModeAtomicGetCursor (drmModeAtomicReqPtr req) { +if (!req) +return -EINVAL ;return req->cursor; }void drmModeAtomicSetCursor (drmModeAtomicReqPtr req,int cursor) { - req->cursor = cursor; +if (req) + req->cursor = cursor; } int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
@@ -1252,6 +1261,9 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, uint32_t property_id, uint64_t value) { +if (!req) +return -EINVAL ; +if (req->cursor >= req->size_items) {drmModeAtomicReqItemPtr new;
@@ -1309,6 +1321,9 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req, uint32_t flags,int obj_idx =-1 ;int ret =-1 ; +if (!req) +return -EINVAL ; +if (req->cursor ==0 )return 0 ;
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] xf86drmMode: smoke-test the atomic API
Quoted 6 lines · Emil Velikov
As going through the modetest patches for atomic support I've noticed that if we pass NULL for the drmModeAtomicReqPtr argument we'll crash.
So let's handle things appropriately if the user forgot to check the return value of drmModeAtomicAlloc and drmModeAtomicDuplicate or made a typo somewhere along the way.
I'm not sure hand-holding the user to such an extent is actually useful. OTOH I guess one NULL check per function call isn't all that expensive either.
Quoted 72 lines
Cc Ville Syrjälä <[email protected]>Cc Rob Clark <[email protected]>Cc Daniel Stone <[email protected]>Signed-off-by Emil Velikov <[email protected]>--- xf86drmMode.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)xf86drmMode.c +16
-1@@ -1189,6 +1189,9 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old) {drmModeAtomicReqPtr new; +if (!old) +return NULL ; + new =drmMalloc (sizeof *new);if (!new)return NULL ;@@ -1213,6 +1216,9 @@ drmModeAtomicReqPtr drmModeAtomicDuplicate(drmModeAtomicReqPtr old)int drmModeAtomicMerge (drmModeAtomicReqPtr base,drmModeAtomicReqPtr augment) { +if (!base) +return -EINVAL ; +if (!augment || augment->cursor ==0 )return 0 ;@@ -1239,12 +1245,15 @@ int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment)int drmModeAtomicGetCursor (drmModeAtomicReqPtr req) { +if (!req) +return -EINVAL ;return req->cursor; }void drmModeAtomicSetCursor (drmModeAtomicReqPtr req,int cursor) { - req->cursor = cursor; +if (req) + req->cursor = cursor; } int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,@@ -1252,6 +1261,9 @@ int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, uint32_t property_id, uint64_t value) { +if (!req) +return -EINVAL ; +if (req->cursor >= req->size_items) {drmModeAtomicReqItemPtr new;@@ -1309,6 +1321,9 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req, uint32_t flags,int obj_idx =-1 ;int ret =-1 ; +if (!req) +return -EINVAL ; +if (req->cursor ==0 )return 0 ;Signature · 1 line
2.5.0
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH libdrm 2/2] xf86drmMode: smoke-test the atomic API
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Emil Velikov
As going through the modetest patches for atomic support I've noticed that if we pass NULL for the drmModeAtomicReqPtr argument we'll crash.
So let's handle things appropriately if the user forgot to check the return value of drmModeAtomicAlloc and drmModeAtomicDuplicate or made a typo somewhere along the way.
I'm not sure hand-holding the user to such an extent is actually useful.
From what I've gathered "smoke-testing" is not meant to be smart.
Quoted 3 lines
OTOH I guess one NULL check per function call isn't all that expensive either.
This is pretty much the reason why I bothered :)
Although if anyone feels strongly against it I'll drop the patch.
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel