* [PATCH] avoid to use NULL pointer
@ 2020-02-14 8:26 Monk Liu
0 siblings, 0 replies; 2+ messages in thread
From: Monk Liu @ 2020-02-14 8:26 UTC (permalink / raw)
To: amd-gfx; +Cc: Monk Liu
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
src/lib/umr_read_pm4_stream.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lib/umr_read_pm4_stream.c b/src/lib/umr_read_pm4_stream.c
index 60bea49..317b638 100644
--- a/src/lib/umr_read_pm4_stream.c
+++ b/src/lib/umr_read_pm4_stream.c
@@ -325,6 +325,9 @@ int umr_pm4_decode_ring_is_halted(struct umr_asic *asic, char *ringname)
// since the kernel returned values might be unwrapped.
for (n = 0; n < 100; n++) {
ringdata = umr_read_ring_data(asic, ringname, &ringsize);
+ if (!ringdata)
+ return 1;
+
ringsize /= 4;
ringdata[0] %= ringsize;
ringdata[1] %= ringsize;
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] avoid to use NULL pointer
@ 2020-02-14 8:25 Monk Liu
0 siblings, 0 replies; 2+ messages in thread
From: Monk Liu @ 2020-02-14 8:25 UTC (permalink / raw)
To: amd-gfx; +Cc: Monk Liu
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
src/lib/umr_read_pm4_stream.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lib/umr_read_pm4_stream.c b/src/lib/umr_read_pm4_stream.c
index 60bea49..317b638 100644
--- a/src/lib/umr_read_pm4_stream.c
+++ b/src/lib/umr_read_pm4_stream.c
@@ -325,6 +325,9 @@ int umr_pm4_decode_ring_is_halted(struct umr_asic *asic, char *ringname)
// since the kernel returned values might be unwrapped.
for (n = 0; n < 100; n++) {
ringdata = umr_read_ring_data(asic, ringname, &ringsize);
+ if (!ringdata)
+ return 1;
+
ringsize /= 4;
ringdata[0] %= ringsize;
ringdata[1] %= ringsize;
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-14 8:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 8:26 [PATCH] avoid to use NULL pointer Monk Liu
-- strict thread matches above, loose matches on Subject: below --
2020-02-14 8:25 Monk Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).