Pass address instead of value to FBIO_WAITFORVSYNC. Now get_user() should
be happy and we get protection from bogus values.

I also included a new matroxfb patch.
* bugfix: -EFAULT; -> return -EFAULT;
* FBIO_WAITFORVSYNC definition: 0x4620 -> _IOW('F', 0x20, int)

-- 
Ville Syrj�l�
[EMAIL PROTECTED]
http://www.sci.fi/~syrjala/
Index: gfxdrivers/matrox/matrox_crtc2.c
===================================================================
RCS file: /cvs/directfb/DirectFB/gfxdrivers/matrox/matrox_crtc2.c,v
retrieving revision 1.2
diff -u -r1.2 matrox_crtc2.c
--- gfxdrivers/matrox/matrox_crtc2.c    27 Sep 2002 12:50:50 -0000      1.2
+++ gfxdrivers/matrox/matrox_crtc2.c    11 Nov 2002 16:26:12 -0000
@@ -89,6 +89,8 @@
      struct mavenregs mr;
 } MatroxCrtc2LayerData;
 
+static const int one = 1;
+
 static void crtc2_wait_vsync( MatroxDriverData *mdrv );
 static void crtc2_set_mafc( MatroxDriverData *mdrv, int on );
 static void crtc2_set_regs( MatroxDriverData *mdrv, MatroxCrtc2LayerData *mcrtc2 );
@@ -398,14 +400,13 @@
 
 static void crtc2_wait_vsync( MatroxDriverData *mdrv )
 {
+     int vdisplay = (dfb_config->matrox_ntsc ? 486/2 : 576/2) + 2;
 #ifdef FBIO_WAITFORVSYNC
      dfb_gfxcard_sync();
-     ioctl( dfb_fbdev->fd, FBIO_WAITFORVSYNC, 1 );
-#else
-     int vdisplay = (dfb_config->matrox_ntsc ? 486/2 : 576/2) + 2;
+     ioctl( dfb_fbdev->fd, FBIO_WAITFORVSYNC, &one );
+#endif
      while ((mga_in32( mdrv->mmio_base, C2VCOUNT ) & 0x00000FFF) != vdisplay)
           ;
-#endif
 }
 
 static void crtc2_set_mafc( MatroxDriverData     *mdrv,
Index: src/core/fbdev/fbdev.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/fbdev/fbdev.c,v
retrieving revision 1.21
diff -u -r1.21 fbdev.c
--- src/core/fbdev/fbdev.c      11 Nov 2002 05:16:41 -0000      1.21
+++ src/core/fbdev/fbdev.c      11 Nov 2002 16:26:21 -0000
@@ -195,6 +195,8 @@
      /* default DeallocateSurface copes with our chunkless video buffers */
 };
 
+static const int zero = 0;
+
 static DFBResult dfb_fbdev_read_modes();
 static DFBResult dfb_fbdev_set_gamma_ramp( DFBSurfacePixelFormat format );
 #ifdef SUPPORT_RGB332
@@ -633,7 +635,7 @@
 
 #ifdef FBIO_WAITFORVSYNC
      dfb_gfxcard_sync();
-     if (ioctl( dfb_fbdev->fd, FBIO_WAITFORVSYNC, 0 ))
+     if (ioctl( dfb_fbdev->fd, FBIO_WAITFORVSYNC, &zero ))
 #endif
           waitretrace();
 

Attachment: matroxfb-vsync-c2vline-irq-patch-2.4.19.bz2
Description: Binary data

Reply via email to