diff mbox series

[RESEND,libdrm,v3,1/2] tests/modetest: Allocate drmModeAtomicReq before setting properties

Message ID 20220901230924.145-2-quic_jesszhan@quicinc.com (mailing list archive)
State New, archived
Headers show
Series Add Writeback Support for Modetest | expand

Commit Message

Jessica Zhang Sept. 1, 2022, 11:09 p.m. UTC
From: Rohith Iyer <quic_rohiiyer@quicinc.com>

Fix null pointer deference caused by drmModeAtomicReq being
allocated before set_property was called when modetest was run
with the atomic flag.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Rohith Iyer <quic_rohiiyer@quicinc.com>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---
 tests/modetest/modetest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Dmitry Baryshkov Sept. 2, 2022, 6:10 a.m. UTC | #1
On 2 September 2022 02:09:23 GMT+03:00, Jessica Zhang <quic_jesszhan@quicinc.com> wrote:
>From: Rohith Iyer <quic_rohiiyer@quicinc.com>
>
>Fix null pointer deference caused by drmModeAtomicReq being
>allocated before set_property was called when modetest was run
>with the atomic flag.

... being allocated _after_ ...

Other than that:

Reviewed-by: Dmitry Baryshkov<dmitry.baryshkov@linaro.org>

>
>Reviewed-by: Rob Clark <robdclark@gmail.com>
>Signed-off-by: Rohith Iyer <quic_rohiiyer@quicinc.com>
>Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
>---
> tests/modetest/modetest.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
>index 42e2d1f4..2c31c4fc 100644
>--- a/tests/modetest/modetest.c
>+++ b/tests/modetest/modetest.c
>@@ -2186,11 +2186,13 @@ int main(int argc, char **argv)
> 	dump_resource(&dev, planes);
> 	dump_resource(&dev, framebuffers);
> 
>+	if (dev.use_atomic)
>+		dev.req = drmModeAtomicAlloc();
>+
> 	for (i = 0; i < prop_count; ++i)
> 		set_property(&dev, &prop_args[i]);
> 
> 	if (dev.use_atomic) {
>-		dev.req = drmModeAtomicAlloc();
> 
> 		if (set_preferred || (count && plane_count)) {
> 			uint64_t cap = 0;
diff mbox series

Patch

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 42e2d1f4..2c31c4fc 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -2186,11 +2186,13 @@  int main(int argc, char **argv)
 	dump_resource(&dev, planes);
 	dump_resource(&dev, framebuffers);
 
+	if (dev.use_atomic)
+		dev.req = drmModeAtomicAlloc();
+
 	for (i = 0; i < prop_count; ++i)
 		set_property(&dev, &prop_args[i]);
 
 	if (dev.use_atomic) {
-		dev.req = drmModeAtomicAlloc();
 
 		if (set_preferred || (count && plane_count)) {
 			uint64_t cap = 0;