i2c: Use snprintf to set adapter names
authorJean Delvare <khali@linux-fr.org>
Wed, 7 Jan 2009 13:29:18 +0000 (14:29 +0100)
committerJean Delvare <khali@linux-fr.org>
Wed, 7 Jan 2009 13:29:18 +0000 (14:29 +0100)
Use snprintf instead of sprintf to set adapter names, it's safer.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/busses/i2c-ali1563.c
drivers/i2c/busses/i2c-amd756-s4882.c
drivers/i2c/busses/i2c-amd756.c
drivers/i2c/busses/i2c-at91.c
drivers/i2c/busses/i2c-sis5595.c
drivers/i2c/busses/i2c-sis630.c

index fc3e5b026423d8e7ab752c73a93a2e18d1e975b5..dd9e796fad698a18a011f70ef393d05e4d2d096e 100644 (file)
@@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev,
        if ((error = ali1563_setup(dev)))
                goto exit;
        ali1563_adapter.dev.parent = &dev->dev;
-       sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x",
-               ali1563_smba);
+       snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name),
+                "SMBus ALi 1563 Adapter @ %04x", ali1563_smba);
        if ((error = i2c_add_adapter(&ali1563_adapter)))
                goto exit_shutdown;
        return 0;
index 8ba2bcf727d31a3ed725a2a9a0baf5a506046da8..378fcb5d5783fdaa0f724c1bdf3ebd07daa6f2a5 100644 (file)
@@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void)
        for (i = 1; i < 5; i++) {
                s4882_algo[i] = *(amd756_smbus.algo);
                s4882_adapter[i] = amd756_smbus;
-               sprintf(s4882_adapter[i].name,
-                       "SMBus 8111 adapter (CPU%d)", i-1);
+               snprintf(s4882_adapter[i].name, sizeof(s4882_adapter[i].name),
+                        "SMBus 8111 adapter (CPU%d)", i-1);
                s4882_adapter[i].algo = s4882_algo+i;
                s4882_adapter[i].dev.parent = amd756_smbus.dev.parent;
        }
index 424dad6f18d83a13488cfb0b8653db8631859ea1..36bee5b9c9525a7e80b13ac9fac6edba9ca60f56 100644 (file)
@@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
        /* set up the sysfs linkage to our parent device */
        amd756_smbus.dev.parent = &pdev->dev;
 
-       sprintf(amd756_smbus.name, "SMBus %s adapter at %04x",
-               chipname[id->driver_data], amd756_ioport);
+       snprintf(amd756_smbus.name, sizeof(amd756_smbus.name),
+                "SMBus %s adapter at %04x", chipname[id->driver_data],
+                amd756_ioport);
 
        error = i2c_add_adapter(&amd756_smbus);
        if (error) {
index 9efb02137254b61391efa5f30a3b155b6c68998d..67d9dc5b351b57e96d41f97f1d53da5f9c7fc9a1 100644 (file)
@@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
                rc = -ENOMEM;
                goto fail2;
        }
-       sprintf(adapter->name, "AT91");
+       snprintf(adapter->name, sizeof(adapter->name), "AT91");
        adapter->algo = &at91_algorithm;
        adapter->class = I2C_CLASS_HWMON;
        adapter->dev.parent = &pdev->dev;
index dfc2d5eb6a6895f437abcbb7f19ada78f815e618..8ce2daff985c5a4c016d2b7325c09e45277d3509 100644 (file)
@@ -389,8 +389,8 @@ static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_
        /* set up the sysfs linkage to our parent device */
        sis5595_adapter.dev.parent = &dev->dev;
 
-       sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x",
-               sis5595_base + SMB_INDEX);
+       snprintf(sis5595_adapter.name, sizeof(sis5595_adapter.name),
+                "SMBus SIS5595 adapter at %04x", sis5595_base + SMB_INDEX);
        err = i2c_add_adapter(&sis5595_adapter);
        if (err) {
                release_region(sis5595_base + SMB_INDEX, 2);
index e7c4b790da5427393783405f6da6271b120efd64..9c9c016ff2b51e7a12066b3161c3f6bbd1b5041d 100644 (file)
@@ -487,8 +487,8 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i
        /* set up the sysfs linkage to our parent device */
        sis630_adapter.dev.parent = &dev->dev;
 
-       sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x",
-               acpi_base + SMB_STS);
+       snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
+                "SMBus SIS630 adapter at %04x", acpi_base + SMB_STS);
 
        return i2c_add_adapter(&sis630_adapter);
 }