diff mbox series

powerpc/powernv: Add error handling to opal_prd_range_is_valid

Message ID 20231127144108.29782-1-liuhaoran14@163.com (mailing list archive)
State Accepted
Commit e6beb47edb89ca9dc8906515e2dfbeb5913312c8
Headers show
Series powerpc/powernv: Add error handling to opal_prd_range_is_valid | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.

Commit Message

Haoran Liu Nov. 27, 2023, 2:41 p.m. UTC
In the opal_prd_range_is_valid function within opal-prd.c,
error handling was missing for the of_get_address call.
This patch adds necessary error checking, ensuring that the
function gracefully handles scenarios where of_get_address fails.

Signed-off-by: Haoran Liu <liuhaoran14@163.com>
---
 arch/powerpc/platforms/powernv/opal-prd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Ellerman Dec. 31, 2023, 11:07 a.m. UTC | #1
On Mon, 27 Nov 2023 06:41:08 -0800, Haoran Liu wrote:
> In the opal_prd_range_is_valid function within opal-prd.c,
> error handling was missing for the of_get_address call.
> This patch adds necessary error checking, ensuring that the
> function gracefully handles scenarios where of_get_address fails.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/powernv: Add error handling to opal_prd_range_is_valid
      https://git.kernel.org/powerpc/c/e6beb47edb89ca9dc8906515e2dfbeb5913312c8

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/opal-prd.c b/arch/powerpc/platforms/powernv/opal-prd.c
index 327e2f76905d..b66b06efcef1 100644
--- a/arch/powerpc/platforms/powernv/opal-prd.c
+++ b/arch/powerpc/platforms/powernv/opal-prd.c
@@ -66,6 +66,8 @@  static bool opal_prd_range_is_valid(uint64_t addr, uint64_t size)
 		const char *label;
 
 		addrp = of_get_address(node, 0, &range_size, NULL);
+		if (!addrp)
+			continue;
 
 		range_addr = of_read_number(addrp, 2);
 		range_end = range_addr + range_size;