Unverified Commit 0ba9236d authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!13181 drm/msm: Avoid NULL dereference in msm_disp_state_print_regs()

parents e0dc5e14 8c8fe1cf
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -48,20 +48,21 @@ static void msm_disp_state_dump_regs(u32 **reg, u32 aligned_len, void __iomem *b
	}
}

static void msm_disp_state_print_regs(u32 **reg, u32 len, void __iomem *base_addr,
		struct drm_printer *p)
static void msm_disp_state_print_regs(const u32 *dump_addr, u32 len,
		void __iomem *base_addr, struct drm_printer *p)
{
	int i;
	u32 *dump_addr = NULL;
	void __iomem *addr;
	u32 num_rows;

	if (!dump_addr) {
		drm_printf(p, "Registers not stored\n");
		return;
	}

	addr = base_addr;
	num_rows = len / REG_DUMP_ALIGN;

	if (*reg)
		dump_addr = *reg;

	for (i = 0; i < num_rows; i++) {
		drm_printf(p, "0x%lx : %08x %08x %08x %08x\n",
				(unsigned long)(addr - base_addr),
@@ -89,7 +90,7 @@ void msm_disp_state_print(struct msm_disp_state *state, struct drm_printer *p)

	list_for_each_entry_safe(block, tmp, &state->blocks, node) {
		drm_printf(p, "====================%s================\n", block->name);
		msm_disp_state_print_regs(&block->state, block->size, block->base_addr, p);
		msm_disp_state_print_regs(block->state, block->size, block->base_addr, p);
	}

	drm_printf(p, "===================dpu drm state================\n");