Re: A minor bug in sr_ioctl.c for 2.1.13?

tenthumbs@cybernex.net
Wed, 27 Nov 1996 02:40:24 GMT


On Mon, 25 Nov 1996 19:56:36 GMT, you wrote:

>
> Whenever I mount a cdrom with 2.1.13 I get this message:
>
> DEBUG: sr_audio: result for ioctl 5305: fffffff2
>
> which is saying that the code for CDROMREADTOCHDR returned
> -EFAULT.
>
> This is coming from the sr_audio_ioctl function in sr_ioctl.c
> where it says:
>
> if (copy_to_user(...))
> return -EFAULT;
>
> [my bone-headed erroneous garbage deleted]

Sorry about wasting electrons on my stupidity.

This time I realized I should see what's actually going on. At about line
341 in sr_ioctl.c where the code is

if (copy_to_user ((void *) arg, &tochdr, sizeof (struct cdrom_tochdr)))
result = -EFAULT;

I changed it to read

printk("get_fs = %lx; arg = %p; &tochdr = %p;\n",
(unsigned long)get_fs(), arg, &tochdr);
if (copy_to_user ((void *) arg, &tochdr, sizeof (struct cdrom_tochdr)))
result = -EFAULT;

and got

get_fs = 2b; arg = c0754f1a; &tochdr = c0754ede;

With these values, the __kernel_ok test fails as does __user_ok so
copy_to_user always fails. Something seems wrong here.

As always, I am confused.

Thanks.