From 4632a93f015caf6d7db4352f37aab74a39e60d7a Mon Sep 17 00:00:00 2001 From: Boris BREZILLON Date: Fri, 13 Jun 2014 12:23:48 +0200 Subject: [PATCH] i2c: sun6-p2wi: fix call to snprintf Fixes possible issue in case pdev name contains formatting characters. Signed-off-by: Boris BREZILLON Reported-by: Kees Cook Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-sun6i-p2wi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c index 5d2d67820c98..09de4fd12d57 100644 --- a/drivers/i2c/busses/i2c-sun6i-p2wi.c +++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c @@ -237,7 +237,7 @@ static int p2wi_probe(struct platform_device *pdev) if (IS_ERR(p2wi->regs)) return PTR_ERR(p2wi->regs); - snprintf(p2wi->adapter.name, sizeof(p2wi->adapter.name), pdev->name); + strlcpy(p2wi->adapter.name, pdev->name, sizeof(p2wi->adapter.name)); irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(dev, "failed to retrieve irq: %d\n", irq); -- 2.30.2