From: Zhao Hongjiang <zhaohongjiang@huawei.com>
To: perex@perex.cz
Cc: tiwai@suse.de, alsa-devel@alsa-project.org, broonie@kernel.org,
lgirdwood@gmail.com, wfp5p@virginia.edu
Subject: [PATCH] sound: using strlcpy instead of strncpy
Date: Thu, 20 Jun 2013 19:03:55 +0800 [thread overview]
Message-ID: <51C2E19B.1080600@huawei.com> (raw)
for NUL terminated string, need alway set '\0' in the end.
Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
---
sound/oss/soundcard.c | 2 +-
sound/soc/codecs/88pm860x-codec.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index e778034..53ac987 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -99,7 +99,7 @@ int *load_mixer_volumes(char *name, int *levels, int present)
}
n = num_mixer_volumes++;
- strncpy(mixer_vols[n].name, name, 32);
+ strlcpy(mixer_vols[n].name, name, sizeof(mixer_vols[n].name));
if (present)
mixer_vols[n].num = n;
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 60159c0..6b2e6b3 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -1447,7 +1447,7 @@ static int pm860x_codec_probe(struct platform_device *pdev)
goto out;
}
pm860x->irq[i] = res->start + chip->irq_base;
- strncpy(pm860x->name[i], res->name, MAX_NAME_LEN);
+ strlcpy(pm860x->name[i], res->name, sizeof(pm860x->name[i]));
}
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pm860x,
--
1.7.1
next reply other threads:[~2013-06-20 11:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 11:03 Zhao Hongjiang [this message]
2013-06-20 11:15 ` [PATCH] sound: using strlcpy instead of strncpy Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C2E19B.1080600@huawei.com \
--to=zhaohongjiang@huawei.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
--cc=wfp5p@virginia.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.