Re: 2.1.80 miscellanea

Michael Elizabeth Chastain (mec@shout.net)
Wed, 21 Jan 1998 13:27:29 -0600


Hi Thomas and Linus and kernel hackers,

> The first patch changes Rules.make to consistently use
> $(RM) instead of rm and to use mv -f instead of mv.
> Otherwise, make may ask to replace a .ver file during
> the make process.

I see nothing wrong with this, go for it.

> - strcpy(info.id, mixer_devs[dev]->id);
> - for (i = 0; i < 32 && mixer_devs[dev]->name; i++)
> - info.name[i] = mixer_devs[dev]->name[i];
> - info.name[i] = 0;
> + strncpy(info.id, mixer_devs[dev]->id, sizeof(info.id));
> + info.name[0] = 0;
> + if (mixer_devs[dev]->name)
> + strncpy(info.name, mixer_devs[dev]->name, sizeof(info.name));

The new code fails to null-terminate the strings if the strings
are too long (this is better than the old code though!) I think
you need these lines:

info.id[sizeof(info.id)-1] = '\0';

indo.name[sizeof(info.name)-1] = '\0';

> if (__copy_to_user(arg, &info, sizeof(info)))
> return -EFAULT;

Also, I recommend changing __copy_to_user to copy_to_user for the sake
of safety.

Michael Chastain
<mailto:mec@shout.net>
"love without fear"