Re: [PATCH v5 2/2] imx-drm: imx-ldb: Use snprintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Freitag, den 28.02.2014, 11:39 -0300 schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> 
> 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,

"di%d_pll" - Six characters, a sign, 10 digits (INT_MIN), and '\0',
that's 18 characters.

> but 16 is based on theory as well.
> 
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> ---
> Changes since v4:
> - None
> 
>  drivers/staging/imx-drm/imx-ldb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c
> index abf8517..daa54df 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);

Acked-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>

regards
Philipp

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux