Commit e3fe40f4 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] further sound updates

Switching back to strlcpy/memset to avoid padding problems
parent 044eb16b
......@@ -2030,8 +2030,9 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar
VALIDATE_CARD(card);
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
strncpy(info.id, card_names[card->card_type], sizeof(info.id));
strncpy(info.name, card_names[card->card_type], sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, card_names[card->card_type], sizeof(info.id));
strlcpy(info.name, card_names[card->card_type], sizeof(info.name));
info.modify_counter = card->mix.modcnt;
if (copy_to_user((void *)arg, &info, sizeof(info)))
return -EFAULT;
......@@ -2039,8 +2040,9 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar
}
if (cmd == SOUND_OLD_MIXER_INFO) {
_old_mixer_info info;
strncpy(info.id, card_names[card->card_type], sizeof(info.id));
strncpy(info.name, card_names[card->card_type], sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, card_names[card->card_type], sizeof(info.id));
strlcpy(info.name, card_names[card->card_type], sizeof(info.name));
if (copy_to_user((void *)arg, &info, sizeof(info)))
return -EFAULT;
return 0;
......
......@@ -555,8 +555,9 @@ static unsigned long force_recsrc(unsigned long recsrc)
}
#define set_mixer_info() \
strncpy(info.id, "MSNDMIXER", sizeof(info.id)); \
strncpy(info.name, "MultiSound Mixer", sizeof(info.name));
memset(&info, 0, sizeof(info)); \
strlcpy(info.id, "MSNDMIXER", sizeof(info.id)); \
strlcpy(info.name, "MultiSound Mixer", sizeof(info.name));
static int mixer_ioctl(unsigned int cmd, unsigned long arg)
{
......
......@@ -1046,8 +1046,9 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg)
VALIDATE_STATE(s);
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
strncpy(info.id, "SonicVibes", sizeof(info.id));
strncpy(info.name, "S3 SonicVibes", sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, "SonicVibes", sizeof(info.id));
strlcpy(info.name, "S3 SonicVibes", sizeof(info.name));
info.modify_counter = s->mix.modcnt;
if (copy_to_user((void *)arg, &info, sizeof(info)))
return -EFAULT;
......@@ -1055,8 +1056,9 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg)
}
if (cmd == SOUND_OLD_MIXER_INFO) {
_old_mixer_info info;
strncpy(info.id, "SonicVibes", sizeof(info.id));
strncpy(info.name, "S3 SonicVibes", sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, "SonicVibes", sizeof(info.id));
strlcpy(info.name, "S3 SonicVibes", sizeof(info.name));
if (copy_to_user((void *)arg, &info, sizeof(info)))
return -EFAULT;
return 0;
......
......@@ -288,9 +288,9 @@ static int sound_release(struct inode *inode, struct file *file)
static int get_mixer_info(int dev, caddr_t arg)
{
mixer_info info;
strncpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
strncpy(info.name, mixer_devs[dev]->name, sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
strlcpy(info.name, mixer_devs[dev]->name, sizeof(info.name));
info.modify_counter = mixer_devs[dev]->modify_counter;
if (__copy_to_user(arg, &info, sizeof(info)))
return -EFAULT;
......@@ -300,9 +300,9 @@ static int get_mixer_info(int dev, caddr_t arg)
static int get_old_mixer_info(int dev, caddr_t arg)
{
_old_mixer_info info;
strncpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
strncpy(info.name, mixer_devs[dev]->name, sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
strlcpy(info.name, mixer_devs[dev]->name, sizeof(info.name));
if (copy_to_user(arg, &info, sizeof(info)))
return -EFAULT;
return 0;
......
......@@ -90,7 +90,6 @@
#include <asm/sibyte/64bit.h>
struct cs4297a_state;
EXPORT_NO_SYMBOLS;
static void stop_dac(struct cs4297a_state *s);
static void stop_adc(struct cs4297a_state *s);
......@@ -1238,8 +1237,9 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd,
}
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
strncpy(info.id, "CS4297a", sizeof(info.id));
strncpy(info.name, "Crystal CS4297a", sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, "CS4297a", sizeof(info.id));
strlcpy(info.name, "Crystal CS4297a", sizeof(info.name));
info.modify_counter = s->mix.modcnt;
if (copy_to_user((void *) arg, &info, sizeof(info)))
return -EFAULT;
......@@ -1247,8 +1247,9 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd,
}
if (cmd == SOUND_OLD_MIXER_INFO) {
_old_mixer_info info;
strncpy(info.id, "CS4297a", sizeof(info.id));
strncpy(info.name, "Crystal CS4297a", sizeof(info.name));
memset(&info, 0, sizeof(info));
strlcpy(info.id, "CS4297a", sizeof(info.id));
strlcpy(info.name, "Crystal CS4297a", sizeof(info.name));
if (copy_to_user((void *) arg, &info, sizeof(info)))
return -EFAULT;
return 0;
......
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