From 629cf711fcba85f4bb3ee6eef64ef902d129ef6d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 7 May 2019 08:37:23 -0400 Subject: [PATCH] import xorg-x11-drv-v4l-0.3.0-2.el8 --- .gitignore | 1 + .xorg-x11-drv-v4l.metadata | 1 + .../0001-Remove-unused-variable-osname.patch | 29 ++ ...e-the-device-name-is-null-terminated.patch | 43 +++ ...0003-Fix-handling-of-realloc-failure.patch | 41 +++ ...0004-Fix-ioctl-return-value-handling.patch | 42 +++ SPECS/xorg-x11-drv-v4l.spec | 278 ++++++++++++++++++ 7 files changed, 435 insertions(+) create mode 100644 .gitignore create mode 100644 .xorg-x11-drv-v4l.metadata create mode 100644 SOURCES/0001-Remove-unused-variable-osname.patch create mode 100644 SOURCES/0002-Ensure-the-device-name-is-null-terminated.patch create mode 100644 SOURCES/0003-Fix-handling-of-realloc-failure.patch create mode 100644 SOURCES/0004-Fix-ioctl-return-value-handling.patch create mode 100644 SPECS/xorg-x11-drv-v4l.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..04414df --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/xf86-video-v4l-0.3.0.tar.bz2 diff --git a/.xorg-x11-drv-v4l.metadata b/.xorg-x11-drv-v4l.metadata new file mode 100644 index 0000000..9194867 --- /dev/null +++ b/.xorg-x11-drv-v4l.metadata @@ -0,0 +1 @@ +e29308282fd2f12626e2582d07f9c932804b25d3 SOURCES/xf86-video-v4l-0.3.0.tar.bz2 diff --git a/SOURCES/0001-Remove-unused-variable-osname.patch b/SOURCES/0001-Remove-unused-variable-osname.patch new file mode 100644 index 0000000..62c779e --- /dev/null +++ b/SOURCES/0001-Remove-unused-variable-osname.patch @@ -0,0 +1,29 @@ +From 3f9022bdfe3d720ea27cb688512b4672d26a6dd6 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 8 Oct 2018 12:55:37 +1000 +Subject: [PATCH xf86-video-v4l 1/4] Remove unused variable osname + +Coverity is unhappy and there's enough unhappiness in this world already, so +let's go for the low-hanging fruit. + +Signed-off-by: Peter Hutterer +Reviewed-by: Dave Airlie +--- + src/v4l.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/v4l.c b/src/v4l.c +index 8db8f7d..0f1058e 100644 +--- a/src/v4l.c ++++ b/src/v4l.c +@@ -86,7 +86,6 @@ _X_EXPORT XF86ModuleData v4lModuleData = { &v4lVersRec, v4lSetup, NULL }; + static pointer + v4lSetup(pointer module, pointer opts, int *errmaj, int *errmin) + { +- const char *osname; + static Bool setupDone = FALSE; + + if (setupDone) { +-- +2.17.1 + diff --git a/SOURCES/0002-Ensure-the-device-name-is-null-terminated.patch b/SOURCES/0002-Ensure-the-device-name-is-null-terminated.patch new file mode 100644 index 0000000..b3b05e5 --- /dev/null +++ b/SOURCES/0002-Ensure-the-device-name-is-null-terminated.patch @@ -0,0 +1,43 @@ +From a020fda02fd0aca0c53b2368e6602bbd12002936 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 8 Oct 2018 12:55:57 +1000 +Subject: [PATCH xf86-video-v4l 2/4] Ensure the device name is null-terminated + +And expand the size to 18, because the stack array we copied this into is 18 +bytes long. This covers us for up to 999 (kernel) v4l devices and that is +definitely not a reason to use the "640k ought to be enough" meme. + +Found by - you guessed it - coverity! + +Signed-off-by: Peter Hutterer +Reviewed-by: Dave Airlie +--- + src/v4l.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/v4l.c b/src/v4l.c +index 0f1058e..583c7b8 100644 +--- a/src/v4l.c ++++ b/src/v4l.c +@@ -188,7 +188,7 @@ static const XF86AttributeRec FreqAttr = + static struct V4L_DEVICE { + int fd; + int useCount; +- char devName[16]; ++ char devName[18]; + } v4l_devices[MAX_V4L_DEVICES] = { + { -1 }, + { -1 }, +@@ -1157,7 +1157,8 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) + } + + xf86Msg(X_INFO, "v4l: enabling overlay mode for %s.\n", dev); +- strncpy(V4L_NAME, dev, 16); ++ strncpy(V4L_NAME, dev, 18); ++ V4L_NAME[17] = '\0'; + V4LBuildEncodings(pPPriv, fd); + if (NULL == pPPriv->enc) + return FALSE; +-- +2.17.1 + diff --git a/SOURCES/0003-Fix-handling-of-realloc-failure.patch b/SOURCES/0003-Fix-handling-of-realloc-failure.patch new file mode 100644 index 0000000..5c3bb6a --- /dev/null +++ b/SOURCES/0003-Fix-handling-of-realloc-failure.patch @@ -0,0 +1,41 @@ +From 3370b6b6a41a27123a45b95ba4820395127c84e7 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 8 Oct 2018 13:05:09 +1000 +Subject: [PATCH xf86-video-v4l 3/4] Fix handling of realloc failure + +Coverity complaint and whatnot + +Signed-off-by: Peter Hutterer +Reviewed-by: Dave Airlie +--- + src/v4l.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/v4l.c b/src/v4l.c +index 583c7b8..8c2408c 100644 +--- a/src/v4l.c ++++ b/src/v4l.c +@@ -1120,6 +1120,7 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) + XF86VideoAdaptorPtr *VAR = NULL; + char dev[18]; + int fd,i,j,d; ++ void *tmp; + + for (i = 0, d = 0; d < MAX_V4L_DEVICES; d++) { + sprintf(dev, "/dev/video%d", d); +@@ -1164,7 +1165,11 @@ V4LInit(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr **adaptors) + return FALSE; + + /* alloc VideoAdaptorRec */ +- VAR = realloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1)); ++ tmp = realloc(VAR,sizeof(XF86VideoAdaptorPtr)*(i+1)); ++ if (!tmp) ++ return FALSE; ++ VAR = tmp; ++ + VAR[i] = malloc(sizeof(XF86VideoAdaptorRec)); + if (!VAR[i]) + return FALSE; +-- +2.17.1 + diff --git a/SOURCES/0004-Fix-ioctl-return-value-handling.patch b/SOURCES/0004-Fix-ioctl-return-value-handling.patch new file mode 100644 index 0000000..0675986 --- /dev/null +++ b/SOURCES/0004-Fix-ioctl-return-value-handling.patch @@ -0,0 +1,42 @@ +From b3244827d97c6659842544b9cc175631e13ae8f3 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Mon, 8 Oct 2018 13:06:41 +1000 +Subject: [PATCH xf86-video-v4l 4/4] Fix ioctl return value handling + +Found by coverity + +Signed-off-by: Peter Hutterer +Reviewed-by: Dave Airlie +--- + src/v4l.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/src/v4l.c b/src/v4l.c +index 8c2408c..9c6fabe 100644 +--- a/src/v4l.c ++++ b/src/v4l.c +@@ -769,12 +769,15 @@ V4lSetPortAttribute(ScrnInfoPtr pScrn, + } else if (attribute == xvFreq) { + struct v4l2_frequency freq; + memset(&freq, 0, sizeof(freq)); +- ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq); +- freq.frequency = value; +- if (ioctl(V4L_FD, VIDIOC_S_FREQUENCY, &freq) == -1) +- xf86Msg(X_ERROR, "v4l: Error %d while setting frequency\n", errno); +- else +- ret = Success; ++ if (ioctl(V4L_FD, VIDIOC_G_FREQUENCY, &freq) == -1) { ++ xf86Msg(X_ERROR, "v4l: Error %d while getting frequency\n", errno); ++ } else { ++ freq.frequency = value; ++ if (ioctl(V4L_FD, VIDIOC_S_FREQUENCY, &freq) == -1) ++ xf86Msg(X_ERROR, "v4l: Error %d while setting frequency\n", errno); ++ else ++ ret = Success; ++ } + } else { + for (i = 0; i < pPPriv->n_qctrl; i++) + if (pPPriv->XvV4LCtrl[i].xv == attribute) +-- +2.17.1 + diff --git a/SPECS/xorg-x11-drv-v4l.spec b/SPECS/xorg-x11-drv-v4l.spec new file mode 100644 index 0000000..abd7849 --- /dev/null +++ b/SPECS/xorg-x11-drv-v4l.spec @@ -0,0 +1,278 @@ +%global tarball xf86-video-v4l +%global moduledir %(pkg-config xorg-server --variable=moduledir ) +%global driverdir %{moduledir}/drivers + +%undefine _hardened_build + +Summary: Xorg X11 v4l video driver +Name: xorg-x11-drv-v4l +Version: 0.3.0 +Release: 2%{?dist} +URL: http://www.x.org +License: MIT +Group: User Interface/X Hardware Support + +Source0: https://www.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2 + +Patch01: 0001-Remove-unused-variable-osname.patch +Patch02: 0002-Ensure-the-device-name-is-null-terminated.patch +Patch03: 0003-Fix-handling-of-realloc-failure.patch +Patch04: 0004-Fix-ioctl-return-value-handling.patch + +ExcludeArch: s390 s390x + +BuildRequires: xorg-x11-server-devel >= 1.10.99.902 +BuildRequires: autoconf automake libtool + +Requires: Xorg %([ -e /usr/bin/xserver-sdk-abi-requires ] && xserver-sdk-abi-requires ansic || :) +Requires: Xorg %([ -e /usr/bin/xserver-sdk-abi-requires ] && xserver-sdk-abi-requires videodrv || :) + +%description +X.Org X11 v4l video driver. + +%prep +%autosetup -p1 -n %{tarball}-%{version} + +%build +autoreconf -vif +%configure --disable-static +make + +%install +rm -rf $RPM_BUILD_ROOT + +make install DESTDIR=$RPM_BUILD_ROOT + +# FIXME: Remove all libtool archives (*.la) from modules directory. This +# should be fixed in upstream Makefile.am or whatever. +find $RPM_BUILD_ROOT -regex ".*\.la$" | xargs rm -f -- + +%files +%{driverdir}/v4l_drv.so +%{_mandir}/man4/v4l.4* + +%changelog +* Mon Oct 08 2018 Peter Hutterer 0.3.0-2 +- Fix coverity complaints (#1636829) +- Use autosetup + +* Tue Aug 14 2018 Adam Jackson - 0.3.0-1 +- v4l 0.3.0 + +* Fri Jul 20 2018 Peter Hutterer 0.2.0-54 +- Remove call to LoaderGetOS (#1602317) + +* Sat Jul 14 2018 Fedora Release Engineering - 0.2.0-53 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Apr 02 2018 Adam Jackson - 0.2.0-52 +- Rebuild for xserver 1.20 + +* Fri Feb 09 2018 Fedora Release Engineering - 0.2.0-51 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 0.2.0-50 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.2.0-49 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.2.0-48 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Sep 29 2016 Hans de Goede - 0.2.0-47 +- Rebuild against xserver-1.19 + +* Fri Feb 05 2016 Fedora Release Engineering - 0.2.0-46 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jan 28 2016 Peter Hutterer +- Remove unnecessary defattr + +* Wed Jan 20 2016 Peter Hutterer +- s/define/global/ + +* Wed Jul 29 2015 Dave Airlie - 0.2.0-45 +- 1.15 ABI rebuild + +* Tue Jun 23 2015 Adam Jackson - 0.2.0-44 +- Undefine _hardened_build + +* Fri Jun 19 2015 Fedora Release Engineering - 0.2.0-43 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Feb 11 2015 Hans de Goede - 0.2.0-42 +- xserver 1.17 ABI rebuild + +* Mon Aug 18 2014 Fedora Release Engineering - 0.2.0-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Mon Jun 16 2014 Hans de Goede - 0.2.0-40 +- xserver 1.15.99.903 ABI rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 0.2.0-39 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Apr 29 2014 Adam Jackson 0.2.0-38 +- v4l2 patch is MIT-compatible, fix License to match + +* Mon Apr 28 2014 Hans de Goede - 0.2.0-37 +- xserver 1.15.99-20140428 git snapshot ABI rebuild + +* Mon Jan 13 2014 Adam Jackson - 0.2.0-36 +- 1.15 ABI rebuild + +* Tue Dec 17 2013 Adam Jackson - 0.2.0-35 +- 1.15RC4 ABI rebuild + +* Wed Nov 20 2013 Adam Jackson - 0.2.0-34 +- 1.15RC2 ABI rebuild + +* Wed Nov 06 2013 Adam Jackson - 0.2.0-33 +- 1.15RC1 ABI rebuild + +* Fri Oct 25 2013 Adam Jackson - 0.2.0-32 +- ABI rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 0.2.0-31 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Tue Mar 19 2013 Adam Jackson 0.2.0-30 +- Less RHEL customization + +* Thu Mar 07 2013 Dave Airlie 0.2.0-29 +- autoreconf for aarch64 + +* Thu Mar 07 2013 Peter Hutterer - 0.2.0-28 +- require xorg-x11-server-devel, not -sdk + +* Thu Mar 07 2013 Peter Hutterer - 0.2.0-27 +- ABI rebuild + +* Fri Feb 15 2013 Peter Hutterer - 0.2.0-26 +- ABI rebuild + +* Fri Feb 15 2013 Peter Hutterer - 0.2.0-25 +- ABI rebuild + +* Thu Jan 10 2013 Adam Jackson - 0.2.0-24 +- ABI rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 0.2.0-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Jul 18 2012 Dave Airlie - 0.2.0-22 +- ABI rebuild + +* Thu Apr 05 2012 Adam Jackson - 0.2.0-21 +- RHEL arch exclude updates + +* Sat Feb 11 2012 Peter Hutterer - 0.2.0-20 +- ABI rebuild + +* Fri Feb 10 2012 Peter Hutterer - 0.2.0-19 +- ABI rebuild + +* Tue Jan 24 2012 Peter Hutterer - 0.2.0-18 +- ABI rebuild + +* Wed Jan 04 2012 Peter Hutterer - 0.2.0-17 +- Rebuild for server 1.12 + +* Mon Nov 14 2011 Adam Jackson - 0.2.0-16 +- ABI rebuild + +* Wed Nov 09 2011 ajax - 0.2.0-15 +- ABI rebuild + +* Thu Aug 18 2011 Adam Jackson - 0.2.0-14 +- Rebuild for xserver 1.11 ABI + +* Wed May 11 2011 Peter Hutterer - 0.2.0-13 +- Rebuild for server 1.11 + +* Mon Feb 28 2011 Peter Hutterer - 0.2.0-12 +- Rebuild for server 1.10 + +* Thu Feb 10 2011 Mauro Carvalho Chehab - 0.2.0-10 +- Removed the v4l1 compat layer and converted the driver to direclty use + the v4l2 API. With this, new standards and new Port Attributes are now + shown, reflecting what the driver is exporting. + +* Wed Feb 09 2011 Adam Jackson 0.2.0-10 +- Fix License tag to GPLv2+ due to v4l2 patch. + +* Tue Feb 08 2011 Fedora Release Engineering - 0.2.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Feb 03 2011 Mauro Carvalho Chehab - 0.2.0-8 +- Make it work with V4L2 drivers + +* Thu Dec 02 2010 Peter Hutterer - 0.2.0-7 +- Rebuild for server 1.10 + +* Wed Oct 27 2010 Adam Jackson 0.2.0-6 +- Add ABI requires magic (#542742) + +* Mon Jul 05 2010 Peter Hutterer - 0.2.0-5.1 +- rebuild for X Server 1.9 + +* Thu Jan 21 2010 Peter Hutterer - 0.2.0-4.1 +- Rebuild for server 1.8 + +* Mon Jul 27 2009 Fedora Release Engineering - 0.2.0-3.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Jul 15 2009 Adam Jackson - 0.2.0-2.1 +- ABI bump + +* Thu Feb 26 2009 Fedora Release Engineering - 0.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Mar 20 2008 Dave Airlie 0.2.0-1 +- Latest upstream release + +* Wed Feb 20 2008 Fedora Release Engineering - 0.1.1-9 +- Autorebuild for GCC 4.3 + +* Tue Aug 28 2007 Adam Jackson 0.1.1-8 +- Fix ioctl argument on LP64 machines. (#250070) + +* Thu Aug 23 2007 Adam Jackson - 0.1.1-7 +- Rebuild for ppc toolchain bug + +* Mon Jun 18 2007 Adam Jackson 0.1.1-6 +- Update Requires and BuildRequires. Disown the module directories. + +* Fri Feb 16 2007 Adam Jackson 0.1.1-5 +- ExclusiveArch -> ExcludeArch + +* Wed Jul 12 2006 Jesse Keating - 0.1.1-4 +- rebuild + +* Tue May 23 2006 Adam Jackson 0.1.1-3 +- Rebuild for 7.1 ABI fix. + +* Fri May 19 2006 Mike A. Harris 0.1.1-2 +- Added "BuildRequires: xorg-x11-proto-devel" for (#192386) + +* Sun Apr 9 2006 Adam Jackson 0.1.1-1 +- Update to 0.1.1 from 7.1RC1. + +* Tue Feb 07 2006 Jesse Keating 0.0.1.5-1.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Wed Jan 18 2006 Mike A. Harris 0.0.1.5-1 +- Updated xorg-x11-drv-v4l to version 0.0.1.5 from X11R7.0 + +* Tue Dec 20 2005 Mike A. Harris 0.0.1.4-1 +- Updated xorg-x11-drv-v4l to version 0.0.1.4 from X11R7 RC4 +- Removed 'x' suffix from manpage dirs to match RC4 upstream. + +* Fri Nov 4 2005 Mike A. Harris 0.0.1.1-1 +- Updated xorg-x11-drv-v4l to version 0.0.1.1 from X11R7 RC1. For some + unknown reason, the version went backwards from 4.0.0 to 0.0.1.1. +- Fix *.la file removal. + +* Mon Oct 3 2005 Mike A. Harris 4.0.0-1 +- Initial spec file for v4l video driver forked from cirrus driver package.