Commit 66c7acf6 authored by Jean Delvare's avatar Jean Delvare

i2c: Use snprintf to set adapter names

Use snprintf instead of sprintf to set adapter names, it's safer.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 1561bfe5
...@@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev, ...@@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev,
if ((error = ali1563_setup(dev))) if ((error = ali1563_setup(dev)))
goto exit; goto exit;
ali1563_adapter.dev.parent = &dev->dev; ali1563_adapter.dev.parent = &dev->dev;
sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name),
ali1563_smba); "SMBus ALi 1563 Adapter @ %04x", ali1563_smba);
if ((error = i2c_add_adapter(&ali1563_adapter))) if ((error = i2c_add_adapter(&ali1563_adapter)))
goto exit_shutdown; goto exit_shutdown;
return 0; return 0;
......
...@@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void) ...@@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void)
for (i = 1; i < 5; i++) { for (i = 1; i < 5; i++) {
s4882_algo[i] = *(amd756_smbus.algo); s4882_algo[i] = *(amd756_smbus.algo);
s4882_adapter[i] = amd756_smbus; s4882_adapter[i] = amd756_smbus;
sprintf(s4882_adapter[i].name, snprintf(s4882_adapter[i].name, sizeof(s4882_adapter[i].name),
"SMBus 8111 adapter (CPU%d)", i-1); "SMBus 8111 adapter (CPU%d)", i-1);
s4882_adapter[i].algo = s4882_algo+i; s4882_adapter[i].algo = s4882_algo+i;
s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; s4882_adapter[i].dev.parent = amd756_smbus.dev.parent;
} }
......
...@@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev, ...@@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
/* set up the sysfs linkage to our parent device */ /* set up the sysfs linkage to our parent device */
amd756_smbus.dev.parent = &pdev->dev; amd756_smbus.dev.parent = &pdev->dev;
sprintf(amd756_smbus.name, "SMBus %s adapter at %04x", snprintf(amd756_smbus.name, sizeof(amd756_smbus.name),
chipname[id->driver_data], amd756_ioport); "SMBus %s adapter at %04x", chipname[id->driver_data],
amd756_ioport);
error = i2c_add_adapter(&amd756_smbus); error = i2c_add_adapter(&amd756_smbus);
if (error) { if (error) {
......
...@@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev) ...@@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
rc = -ENOMEM; rc = -ENOMEM;
goto fail2; goto fail2;
} }
sprintf(adapter->name, "AT91"); snprintf(adapter->name, sizeof(adapter->name), "AT91");
adapter->algo = &at91_algorithm; adapter->algo = &at91_algorithm;
adapter->class = I2C_CLASS_HWMON; adapter->class = I2C_CLASS_HWMON;
adapter->dev.parent = &pdev->dev; adapter->dev.parent = &pdev->dev;
......
...@@ -389,8 +389,8 @@ static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_ ...@@ -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 */ /* set up the sysfs linkage to our parent device */
sis5595_adapter.dev.parent = &dev->dev; sis5595_adapter.dev.parent = &dev->dev;
sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x", snprintf(sis5595_adapter.name, sizeof(sis5595_adapter.name),
sis5595_base + SMB_INDEX); "SMBus SIS5595 adapter at %04x", sis5595_base + SMB_INDEX);
err = i2c_add_adapter(&sis5595_adapter); err = i2c_add_adapter(&sis5595_adapter);
if (err) { if (err) {
release_region(sis5595_base + SMB_INDEX, 2); release_region(sis5595_base + SMB_INDEX, 2);
......
...@@ -487,8 +487,8 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i ...@@ -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 */ /* set up the sysfs linkage to our parent device */
sis630_adapter.dev.parent = &dev->dev; sis630_adapter.dev.parent = &dev->dev;
sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x", snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
acpi_base + SMB_STS); "SMBus SIS630 adapter at %04x", acpi_base + SMB_STS);
return i2c_add_adapter(&sis630_adapter); return i2c_add_adapter(&sis630_adapter);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment