i2c: sun6-p2wi: fix call to snprintf
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Fri, 13 Jun 2014 10:23:48 +0000 (12:23 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 17 Jun 2014 12:28:04 +0000 (14:28 +0200)
Fixes possible issue in case pdev name contains formatting characters.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Reported-by: Kees Cook <keescook@google.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-sun6i-p2wi.c

index 5d2d67820c9836c9cfd772b16eb1fd2e5ab7fee4..09de4fd12d57b84997d037f32d38ec89137dd35a 100644 (file)
@@ -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);