Skip to content

Commit

Permalink
drm: xlnx: pl_disp: Add strict check of video format in dt parsing.
Browse files Browse the repository at this point in the history
This patch adds strict check of supported video formats in device tree
parsing.

Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com>
Reviewed-by: Vishal Sagar <vishal.sagar@xilinx.com>
State: pending
  • Loading branch information
Venkateshwar Rao Gannavarapu authored and michalsimek committed Jan 5, 2023
1 parent c73a51d commit 630a388
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/gpu/drm/xlnx/xlnx_pl_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "xlnx_drv.h"

#define XLNX_PL_DISP_MAX_NUM_PLANES 3
#define XLNX_PL_DISP_VFMT_SIZE 4
/*
* Overview
* --------
Expand Down Expand Up @@ -585,6 +586,7 @@ static int xlnx_pl_disp_probe(struct platform_device *pdev)
const char *vformat;
struct dma_chan *dma_chan;
struct xlnx_dma_chan *xlnx_dma_chan;
const struct drm_format_info *info;

xlnx_pl_disp = devm_kzalloc(dev, sizeof(*xlnx_pl_disp), GFP_KERNEL);
if (!xlnx_pl_disp)
Expand All @@ -608,7 +610,13 @@ static int xlnx_pl_disp_probe(struct platform_device *pdev)
goto err_dma;
}

strcpy((char *)&xlnx_pl_disp->fmt, vformat);
strncpy((char *)&xlnx_pl_disp->fmt, vformat, XLNX_PL_DISP_VFMT_SIZE);
info = drm_format_info(xlnx_pl_disp->fmt);
if (!info) {
dev_err(dev, "Invalid video format in dts\n");
ret = -EINVAL;
goto err_dma;
}

/* VTC Bridge support */
vtc_node = of_parse_phandle(dev->of_node, "xlnx,bridge", 0);
Expand Down

0 comments on commit 630a388

Please sign in to comment.