[PATCH v6 0/3] Fix IS_ERR() vs NULL check for drm

2023-07-24 Thread Gaosheng Cui
v6:
- Update the first patch, return dev_err_probe(...), Thanks!

v5:
- Update the third patch, change IS_ERR to IS_ERR_OR_NULL.
  Thanks!

v4:
- 1. Update the second patch's commit messages.
  2. Update the first patch, use dev_err_probe() instead of dev_err().

  Thanks!

v3:
- Update the second patch:
  1. change IS_ERR to IS_ERR_OR_NULL
  2. add Dmitry's R-b in this revision:
  link: https://patchwork.freedesktop.org/patch/511035/?series=110745=1

  Thanks!

v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in 
msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar " to the second 
patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR_OR_NULL() vs NULL check in
komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.25.1



[PATCH v6 2/3] drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()

2023-07-24 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, and a null
is catastrophic here, so we should use IS_ERR_OR_NULL() to check
the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
Reviewed-by: Akhil P Oommen 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..bbb1bf33f98e 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR_OR_NULL(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[PATCH v6 3/3] drm/komeda: Fix IS_ERR_OR_NULL() vs NULL check in komeda_component_get_avail_scaler()

2023-07-24 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure,
and a null is catastrophic here we should use IS_ERR_OR_NULL()
to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..f7281dd99727 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR_OR_NULL(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[PATCH v6 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2023-07-24 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

By the way, use dev_err_probe instead of dev_err to print the error code.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..eaba0b8d4340 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,9 +571,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
-   dev_err(dev, "Cannot get secondary DSI node\n");
-   return -ENODEV;
+   if (IS_ERR(nt->dsi[1])) {
+   return dev_err_probe(dev, PTR_ERR(nt->dsi[1]),
+"Cannot get secondary DSI node\n");
}
num_dsis++;
}
-- 
2.25.1



[PATCH v5 3/3] drm/komeda: Fix IS_ERR_OR_NULL() vs NULL check in komeda_component_get_avail_scaler()

2023-07-24 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure,
and a null is catastrophic here we should use IS_ERR_OR_NULL()
to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..f7281dd99727 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR_OR_NULL(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[PATCH v5 0/3] Fix IS_ERR() vs NULL check for drm

2023-07-24 Thread Gaosheng Cui
v5:
- Update the third patch, change IS_ERR to IS_ERR_OR_NULL.
  Thanks!

v4:
- 1. Update the second patch's commit messages.
  2. Update the first patch, use dev_err_probe() instead of dev_err().

  Thanks!

v3:
- Update the second patch:
  1. change IS_ERR to IS_ERR_OR_NULL
  2. add Dmitry's R-b in this revision:
  link: https://patchwork.freedesktop.org/patch/511035/?series=110745=1

  Thanks!

v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in 
msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar " to the second 
patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR_OR_NULL() vs NULL check in
komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.25.1



[PATCH v5 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2023-07-24 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

By the way, use dev_err_probe instead of dev_err to print the error code.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..2731ce02ce53 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,8 +571,8 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
-   dev_err(dev, "Cannot get secondary DSI node\n");
+   if (IS_ERR(nt->dsi[1])) {
+   dev_err_probe(dev, PTR_ERR(nt->dsi[1]), "Cannot get 
secondary DSI node\n");
return -ENODEV;
}
num_dsis++;
-- 
2.25.1



[PATCH v5 2/3] drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()

2023-07-24 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, and a null
is catastrophic here, so we should use IS_ERR_OR_NULL() to check
the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
Reviewed-by: Akhil P Oommen 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..bbb1bf33f98e 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR_OR_NULL(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[PATCH v4 2/3] drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()

2023-07-16 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, and a null
is catastrophic here, so we should use IS_ERR_OR_NULL() to check
the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
Reviewed-by: Akhil P Oommen 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..bbb1bf33f98e 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR_OR_NULL(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[PATCH v4 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2023-07-16 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

By the way, use dev_err_probe instead of dev_err to print the error code.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..2731ce02ce53 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,8 +571,8 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
-   dev_err(dev, "Cannot get secondary DSI node\n");
+   if (IS_ERR(nt->dsi[1])) {
+   dev_err_probe(dev, PTR_ERR(nt->dsi[1]), "Cannot get 
secondary DSI node\n");
return -ENODEV;
}
num_dsis++;
-- 
2.25.1



[PATCH v4 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()

2023-07-16 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[PATCH v4 0/3] Fix IS_ERR() vs NULL check for drm

2023-07-16 Thread Gaosheng Cui
v4:
- 1. Update the second patch's commit messages.
  2. Update the first patch, use dev_err_probe() instead of dev_err().

  Thanks!

v3:
- Update the second patch:
  1. change IS_ERR to IS_ERR_OR_NULL
  2. add Dmitry's R-b in this revision:
  link: https://patchwork.freedesktop.org/patch/511035/?series=110745=1

  Thanks!

v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in 
msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar " to the second 
patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR() vs NULL check in
komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.25.1



[PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()

2023-07-13 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
Reviewed-by: Akhil P Oommen 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..bbb1bf33f98e 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR_OR_NULL(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[PATCH v3 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2023-07-13 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..4903bbf1df55 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,7 +571,7 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
+   if (IS_ERR(nt->dsi[1])) {
dev_err(dev, "Cannot get secondary DSI node\n");
return -ENODEV;
}
-- 
2.25.1



[PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()

2023-07-13 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[PATCH v3 0/3] Fix IS_ERR() vs NULL check for drm

2023-07-13 Thread Gaosheng Cui
v3:
- Update the second patch:
  1. change IS_ERR to IS_ERR_OR_NULL
  2. add Dmitry's R-b in this revision:
  link: https://patchwork.freedesktop.org/patch/511035/?series=110745=1

  Thanks!

v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in 
msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar " to the second 
patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR() vs NULL check in
komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.25.1



[PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()

2023-07-12 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..a499e3b350fc 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()

2023-07-12 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[PATCH v2 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2023-07-12 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..4903bbf1df55 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,7 +571,7 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
+   if (IS_ERR(nt->dsi[1])) {
dev_err(dev, "Cannot get secondary DSI node\n");
return -ENODEV;
}
-- 
2.25.1



[PATCH v2 0/3] Fix IS_ERR() vs NULL check for drm

2023-07-12 Thread Gaosheng Cui
v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in 
msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar " to the second 
patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR() vs NULL check in
komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.25.1



[PATCH] drm: Fix possible memleak and UAF in drm_addmap_core()

2022-11-23 Thread Gaosheng Cui
The dma_free_coherent() should be called when memory fails to
be allocated for list, or drm_map_handle() fails, otherwise there
will be a memory leak, so add dma_free_coherent to fix it.

In addition, if drm_map_handle() fails in drm_addmap_core(), list
will be freed, but list->head will not be removed from dev->map_list,
then list traversal may cause UAF, fix it by removeing it from
dev->map_list before kfree().

Fixes: 8e4ff9b56957 ("drm: Remove the dma_alloc_coherent wrapper for internal 
usage")
Fixes: 8d153f7107ff ("drm: update user token hashing and map handles")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/drm_bufs.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index fcca21e8efac..3b9563194715 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -344,6 +344,8 @@ static int drm_addmap_core(struct drm_device *dev, 
resource_size_t offset,
if (!list) {
if (map->type == _DRM_REGISTERS)
iounmap(map->handle);
+   if (map->type == _DRM_CONSISTENT)
+   dma_free_coherent(dev->dev, map->size, map->handle, 
map->offset);
kfree(map);
return -EINVAL;
}
@@ -361,7 +363,10 @@ static int drm_addmap_core(struct drm_device *dev, 
resource_size_t offset,
if (ret) {
if (map->type == _DRM_REGISTERS)
iounmap(map->handle);
+   if (map->type == _DRM_CONSISTENT)
+   dma_free_coherent(dev->dev, map->size, map->handle, 
map->offset);
kfree(map);
+   list_del(>head);
kfree(list);
mutex_unlock(>struct_mutex);
return ret;
-- 
2.25.1



[PATCH] video: ep93xx: Add missing clk_disable_unprepare in ep93xxfb_probe()

2022-11-23 Thread Gaosheng Cui
The clk_disable_unprepare() should be called in the error handling
of register_framebuffer(), fix it.

Fixes: 0937a7b3625d ("video: ep93xx: Prepare clock before using it")
Signed-off-by: Gaosheng Cui 
---
 drivers/video/fbdev/ep93xx-fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/ep93xx-fb.c b/drivers/video/fbdev/ep93xx-fb.c
index 2398b3d48fed..305f1587bd89 100644
--- a/drivers/video/fbdev/ep93xx-fb.c
+++ b/drivers/video/fbdev/ep93xx-fb.c
@@ -552,12 +552,14 @@ static int ep93xxfb_probe(struct platform_device *pdev)
 
err = register_framebuffer(info);
if (err)
-   goto failed_check;
+   goto failed_framebuffer;
 
dev_info(info->dev, "registered. Mode = %dx%d-%d\n",
 info->var.xres, info->var.yres, info->var.bits_per_pixel);
return 0;
 
+failed_framebuffer:
+   clk_disable_unprepare(fbi->clk);
 failed_check:
if (fbi->mach_info->teardown)
fbi->mach_info->teardown(pdev);
-- 
2.25.1



[PATCH] dma-buf: Fix possible UAF in dma_buf_export

2022-11-16 Thread Gaosheng Cui
Smatch report warning as follows:

drivers/dma-buf/dma-buf.c:681 dma_buf_export() warn:
  '>list_node' not removed from list

If dma_buf_stats_setup() fails in dma_buf_export(), goto err_sysfs
and dmabuf will be freed, but dmabuf->list_node will not be removed
from db_list.head, then list traversal may cause UAF.

Fix by removeing it from db_list.head before free().

Fixes: ef3a6b70507a ("dma-buf: call dma_buf_stats_setup after dmabuf is in 
valid list")
Signed-off-by: Gaosheng Cui 
---
 drivers/dma-buf/dma-buf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index b809513b03fe..6848f50226d5 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -675,6 +675,9 @@ struct dma_buf *dma_buf_export(const struct 
dma_buf_export_info *exp_info)
return dmabuf;
 
 err_sysfs:
+   mutex_lock(_list.lock);
+   list_del(>list_node);
+   mutex_unlock(_list.lock);
/*
 * Set file->f_path.dentry->d_fsdata to NULL so that when
 * dma_buf_release() gets invoked by dentry_ops, it exits
-- 
2.25.1



[PATCH 4/5] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()

2022-11-10 Thread Gaosheng Cui
The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component 
*c,
u32 avail_scalers;
 
pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-   if (!pipe_st)
+   if (IS_ERR(pipe_st))
return NULL;
 
avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1



[PATCH 0/5] Fix IS_ERR() vs NULL check for drm

2022-11-10 Thread Gaosheng Cui
This series contains a few fixup patches, to fix IS_ERR() vs NULL check
for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (5):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()
  drm/komeda: Fix IS_ERR() vs NULL check in
komeda_component_get_avail_scaler()
  drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms

 .../gpu/drm/arm/display/komeda/komeda_pipeline_state.c| 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 drivers/gpu/drm/msm/msm_io_utils.c| 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 drivers/gpu/drm/vc4/vc4_kms.c | 8 
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.25.1



[PATCH 5/5] drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms

2022-11-10 Thread Gaosheng Cui
The drm_atomic_get_new_private_obj_state() function returns NULL
on error path, drm_atomic_get_old_private_obj_state() function
returns NULL on error path, too, they does not return error pointers.

By the way, vc4_hvs_get_new/old_global_state() should return
ERR_PTR(-EINVAL), otherwise there will be null-ptr-defer issue,
such as follows:

In function vc4_atomic_commit_tail():
  |-- old_hvs_state = vc4_hvs_get_old_global_state(state); <-- return NULL
  |-- if (WARN_ON(IS_ERR(old_hvs_state))) <-- no return
  |-- unsigned long state_rate = max(old_hvs_state->core_clock_rate,
new_hvs_state->core_clock_rate); <-- null-ptr-defer

Fixes: 9ec03d7f1ed3 ("drm/vc4: kms: Wait on previous FIFO users before a 
commit")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/vc4/vc4_kms.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index 5c97642ed66a..8fbeecdf2ec4 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -197,8 +197,8 @@ vc4_hvs_get_new_global_state(struct drm_atomic_state *state)
struct drm_private_state *priv_state;
 
priv_state = drm_atomic_get_new_private_obj_state(state, 
>hvs_channels);
-   if (IS_ERR(priv_state))
-   return ERR_CAST(priv_state);
+   if (!priv_state)
+   return ERR_PTR(-EINVAL);
 
return to_vc4_hvs_state(priv_state);
 }
@@ -210,8 +210,8 @@ vc4_hvs_get_old_global_state(struct drm_atomic_state *state)
struct drm_private_state *priv_state;
 
priv_state = drm_atomic_get_old_private_obj_state(state, 
>hvs_channels);
-   if (IS_ERR(priv_state))
-   return ERR_CAST(priv_state);
+   if (!priv_state)
+   return ERR_PTR(-EINVAL);
 
return to_vc4_hvs_state(priv_state);
 }
-- 
2.25.1



[PATCH 3/5] drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()

2022-11-10 Thread Gaosheng Cui
The of_icc_get() function returns NULL or error pointers on error path,
so we should use IS_ERR_OR_NULL() to check the return value.

Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss 
devices")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/msm/msm_io_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_io_utils.c 
b/drivers/gpu/drm/msm/msm_io_utils.c
index d02cd29ce829..950083b2f092 100644
--- a/drivers/gpu/drm/msm/msm_io_utils.c
+++ b/drivers/gpu/drm/msm/msm_io_utils.c
@@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char 
*name)
struct icc_path *path;
 
path = of_icc_get(dev, name);
-   if (path)
+   if (IS_ERR_OR_NULL(path))
return path;
 
/*
-- 
2.25.1



[PATCH 2/5] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()

2022-11-10 Thread Gaosheng Cui
The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 3c537c0016fa..0abc802e8d5f 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct 
msm_gem_submit *submit
 * since we've already mapped it once in
 * submit_reloc()
 */
-   if (WARN_ON(!ptr))
+   if (WARN_ON(IS_ERR(ptr)))
return;
 
for (i = 0; i < dwords; i++) {
-- 
2.25.1



[PATCH 1/5] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()

2022-11-10 Thread Gaosheng Cui
The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC 
panels")
Signed-off-by: Gaosheng Cui 
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c 
b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 3a844917da07..6304fe5b9038 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -579,7 +579,7 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
}
 
nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-   if (!nt->dsi[1]) {
+   if (IS_ERR(nt->dsi[1])) {
dev_err(dev, "Cannot get secondary DSI node\n");
return -ENODEV;
}
-- 
2.25.1



[PATCH] drm/ttm: fix undefined behavior in bit shift for TTM_TT_FLAG_PRIV_POPULATED

2022-10-31 Thread Gaosheng Cui
Shifting signed 32-bit value by 31 bits is undefined, so changing
significant bit to unsigned. The UBSAN warning calltrace like below:

UBSAN: shift-out-of-bounds in ./include/drm/ttm/ttm_tt.h:122:26
left shift of 1 by 31 places cannot be represented in type 'int'
Call Trace:
 
 dump_stack_lvl+0x7d/0xa5
 dump_stack+0x15/0x1b
 ubsan_epilogue+0xe/0x4e
 __ubsan_handle_shift_out_of_bounds+0x1e7/0x20c
 ttm_bo_move_memcpy+0x3b4/0x460 [ttm]
 bo_driver_move+0x32/0x40 [drm_vram_helper]
 ttm_bo_handle_move_mem+0x118/0x200 [ttm]
 ttm_bo_validate+0xfa/0x220 [ttm]
 drm_gem_vram_pin_locked+0x70/0x1b0 [drm_vram_helper]
 drm_gem_vram_pin+0x48/0xb0 [drm_vram_helper]
 drm_gem_vram_plane_helper_prepare_fb+0x53/0xe0 [drm_vram_helper]
 drm_gem_vram_simple_display_pipe_prepare_fb+0x26/0x30 [drm_vram_helper]
 drm_simple_kms_plane_prepare_fb+0x4d/0xe0 [drm_kms_helper]
 drm_atomic_helper_prepare_planes+0xda/0x210 [drm_kms_helper]
 drm_atomic_helper_commit+0xc3/0x1e0 [drm_kms_helper]
 drm_atomic_commit+0x9c/0x160 [drm]
 drm_client_modeset_commit_atomic+0x33a/0x380 [drm]
 drm_client_modeset_commit_locked+0x77/0x220 [drm]
 drm_client_modeset_commit+0x31/0x60 [drm]
 __drm_fb_helper_restore_fbdev_mode_unlocked+0xa7/0x170 [drm_kms_helper]
 drm_fb_helper_set_par+0x51/0x90 [drm_kms_helper]
 fbcon_init+0x316/0x790
 visual_init+0x113/0x1d0
 do_bind_con_driver+0x2a3/0x5c0
 do_take_over_console+0xa9/0x270
 do_fbcon_takeover+0xa1/0x170
 do_fb_registered+0x2a8/0x340
 fbcon_fb_registered+0x47/0xe0
 register_framebuffer+0x294/0x4a0
 __drm_fb_helper_initial_config_and_unlock+0x43c/0x880 [drm_kms_helper]
 drm_fb_helper_initial_config+0x52/0x80 [drm_kms_helper]
 drm_fbdev_client_hotplug+0x156/0x1b0 [drm_kms_helper]
 drm_fbdev_generic_setup+0xfc/0x290 [drm_kms_helper]
 bochs_pci_probe+0x6ca/0x772 [bochs]
 local_pci_probe+0x4d/0xb0
 pci_device_probe+0x119/0x320
 really_probe+0x181/0x550
 __driver_probe_device+0xc6/0x220
 driver_probe_device+0x32/0x100
 __driver_attach+0x195/0x200
 bus_for_each_dev+0xbb/0x120
 driver_attach+0x27/0x30
 bus_add_driver+0x22e/0x2f0
 driver_register+0xa9/0x190
 __pci_register_driver+0x90/0xa0
 bochs_pci_driver_init+0x52/0x1000 [bochs]
 do_one_initcall+0x76/0x430
 do_init_module+0x61/0x28a
 load_module+0x1f82/0x2e50
 __do_sys_finit_module+0xf8/0x190
 __x64_sys_finit_module+0x23/0x30
 do_syscall_64+0x58/0x80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
 

Fixes: 3312be8f6fc8 ("drm/ttm: move populated state into page flags")
Signed-off-by: Gaosheng Cui 
---
 include/drm/ttm/ttm_tt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h
index 17a0310e8aaa..b7d3f3843f1e 100644
--- a/include/drm/ttm/ttm_tt.h
+++ b/include/drm/ttm/ttm_tt.h
@@ -88,7 +88,7 @@ struct ttm_tt {
 #define TTM_TT_FLAG_EXTERNAL   (1 << 2)
 #define TTM_TT_FLAG_EXTERNAL_MAPPABLE  (1 << 3)
 
-#define TTM_TT_FLAG_PRIV_POPULATED  (1 << 31)
+#define TTM_TT_FLAG_PRIV_POPULATED  (1U << 31)
uint32_t page_flags;
/** @num_pages: Number of pages in the page array. */
uint32_t num_pages;
-- 
2.25.1