From: Fabio Estevam Date: Fri, 28 Feb 2014 14:39:42 +0000 (-0300) Subject: imx-drm: imx-ldb: Use snprintf() X-Git-Tag: firefly_0821_release~176^2~4193^2~786 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=98dd3b2a3ad2b234ac9c6e7a233dde21e6e37da6;p=firefly-linux-kernel-4.4.55.git imx-drm: imx-ldb: Use snprintf() Use snprintf() in order to fix the following static checker warning: drivers/staging/imx-drm/imx-ldb.c:340 imx_ldb_get_clk() error: format string overflow. buf_size: 16 length: 18 probably 18 is theory and not real life, but 16 is based on theory as well. Reported-by: Dan Carpenter Signed-off-by: Fabio Estevam Acked-by: Philipp Zabel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index abf85170f6d6..daa54df4527f 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c @@ -334,12 +334,12 @@ static int imx_ldb_get_clk(struct imx_ldb *ldb, int chno) { char clkname[16]; - sprintf(clkname, "di%d", chno); + snprintf(clkname, sizeof(clkname), "di%d", chno); ldb->clk[chno] = devm_clk_get(ldb->dev, clkname); if (IS_ERR(ldb->clk[chno])) return PTR_ERR(ldb->clk[chno]); - sprintf(clkname, "di%d_pll", chno); + snprintf(clkname, sizeof(clkname), "di%d_pll", chno); ldb->clk_pll[chno] = devm_clk_get(ldb->dev, clkname); return PTR_ERR_OR_ZERO(ldb->clk_pll[chno]);