Skip to contentSkip to conversation

i2c: sun6-p2wi: fix call to snprintf

PATCH New Boris BREZILLON 2 participants 2 messages Jun 13, 2014 – Jun 17, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: sun6-p2wi: fix call to snprintf

Fixes possible issue in case pdev name contains formatting characters.

---
Changes since v1:
- use strlcpy instead of snprintf

 drivers/i2c/busses/i2c-sun6i-p2wi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-sun6i-p2wi.c +1 -1
index 5d2d678..09de4fd 100644
@@ -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);
Signature · 1 line
1.8.3.2
Applied
#1 lore raw

PATCH v2 1/1 i2c: sun6-p2wi: fix call to snprintf

Quoted 4 lines · Boris BREZILLON

Fixes possible issue in case pdev name contains formatting characters.

Applied to for-next, thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140617/5188624a/attachment.sig>