[ALSA] sound: strlcpy is smart enough
authorJean Delvare <khali@linux-fr.org>
Tue, 27 Mar 2007 09:50:19 +0000 (11:50 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 11 May 2007 14:55:53 +0000 (16:55 +0200)
strlcpy already accounts for the trailing zero in its length
computation, so there is no need to substract one to the buffer size.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/aoa/codecs/snd-aoa-codec-onyx.c
sound/aoa/codecs/snd-aoa-codec-tas.c

index e91f9f66f3957f3689aba3ae1e8c31a511ad20f9..ded516717940b1d1cba175775cde0ea6aea3a16f 100644 (file)
@@ -1018,7 +1018,7 @@ static int onyx_create(struct i2c_adapter *adapter,
        onyx->i2c.driver = &onyx_driver;
        onyx->i2c.adapter = adapter;
        onyx->i2c.addr = addr & 0x7f;
-       strlcpy(onyx->i2c.name, "onyx audio codec", I2C_NAME_SIZE-1);
+       strlcpy(onyx->i2c.name, "onyx audio codec", I2C_NAME_SIZE);
 
        if (i2c_attach_client(&onyx->i2c)) {
                printk(KERN_ERR PFX "failed to attach to i2c\n");
@@ -1033,7 +1033,7 @@ static int onyx_create(struct i2c_adapter *adapter,
                goto fail;
        }
 
-       strlcpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN-1);
+       strlcpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
        onyx->codec.owner = THIS_MODULE;
        onyx->codec.init = onyx_init_codec;
        onyx->codec.exit = onyx_exit_codec;
index 041fe52cbf2987ce6dfcc2daff3def22bd044c6b..2f771f57c76fbf4207c173b4146bb575fa292cab 100644 (file)
@@ -899,14 +899,14 @@ static int tas_create(struct i2c_adapter *adapter,
        tas->i2c.addr = addr;
        /* seems that half is a saner default */
        tas->drc_range = TAS3004_DRC_MAX / 2;
-       strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE-1);
+       strlcpy(tas->i2c.name, "tas audio codec", I2C_NAME_SIZE);
 
        if (i2c_attach_client(&tas->i2c)) {
                printk(KERN_ERR PFX "failed to attach to i2c\n");
                goto fail;
        }
 
-       strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN-1);
+       strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN);
        tas->codec.owner = THIS_MODULE;
        tas->codec.init = tas_init_codec;
        tas->codec.exit = tas_exit_codec;