* [patch] Does this correct a bug in ibmcam.c?
@ 2001-03-12 8:52 Lee Brown
2001-03-12 19:24 ` Alan Cox
0 siblings, 1 reply; 2+ messages in thread
From: Lee Brown @ 2001-03-12 8:52 UTC (permalink / raw)
To: linux-kernel
I had problems with copy_from_user.
Please CC me as I am not on this list.
__________________________________
--- ibmcam.c.orig Fri Feb 9 14:30:23 2001
+++ ibmcam.c Mon Mar 12 02:58:57 2001
@@ -2527,16 +2527,17 @@
}
case VIDIOCSCHAN:
{
- int v;
+ int chan;
- if (copy_from_user(&v, arg, sizeof(v)))
- return -EFAULT;
- if ((v < 0) || (v >= 3)) /* 3 grades of lighting conditions */
- return -EINVAL;
- if (v != ibmcam->vchan.channel) {
- ibmcam->vchan.channel = v;
+ chan = (int)arg;
+
+ if ((chan < 0) || (chan >= 3)) /* 3 grades of lighting conditions */
+ return -EINVAL;
+
+ if (chan != ibmcam->vchan.channel) {
+ ibmcam->vchan.channel = chan;
usb_ibmcam_change_lighting_conditions(ibmcam);
- }
+ }
return 0;
}
case VIDIOCGPICT:
--
Lee Brown Jr.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Does this correct a bug in ibmcam.c?
2001-03-12 8:52 [patch] Does this correct a bug in ibmcam.c? Lee Brown
@ 2001-03-12 19:24 ` Alan Cox
0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2001-03-12 19:24 UTC (permalink / raw)
To: Lee Brown; +Cc: linux-kernel
> + int chan;
>
> - if (copy_from_user(&v, arg, sizeof(v)))
> - return -EFAULT;
> - if ((v < 0) || (v >= 3)) /* 3 grades of lighting conditions */
> - return -EINVAL;
> - if (v != ibmcam->vchan.channel) {
> - ibmcam->vchan.channel = v;
> + chan = (int)arg;
> +
> + if ((chan < 0) || (chan >= 3)) /* 3 grades of lighting conditions */
> + return -EINVAL;
> +
> + if (chan != ibmcam->vchan.channel) {
> + ibmcam->vchan.channel = chan;
> usb_ibmcam_change_lighting_conditions(ibmcam);
> - }
> + }
> return 0;
> }
This change is wrong. I think you are calling the ioctl wrongly
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-03-12 19:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-12 8:52 [patch] Does this correct a bug in ibmcam.c? Lee Brown
2001-03-12 19:24 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).