Compare commits

...

No commits in common. 'c9' and 'c8' have entirely different histories.
c9 ... c8

@ -0,0 +1,29 @@
From 3f9022bdfe3d720ea27cb688512b4672d26a6dd6 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
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 <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
---
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

@ -0,0 +1,43 @@
From a020fda02fd0aca0c53b2368e6602bbd12002936 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
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 <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
---
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

@ -0,0 +1,41 @@
From 3370b6b6a41a27123a45b95ba4820395127c84e7 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
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 <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
---
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

@ -0,0 +1,42 @@
From b3244827d97c6659842544b9cc175631e13ae8f3 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
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 <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
---
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

@ -2,18 +2,25 @@
%global moduledir %(pkg-config xorg-server --variable=moduledir ) %global moduledir %(pkg-config xorg-server --variable=moduledir )
%global driverdir %{moduledir}/drivers %global driverdir %{moduledir}/drivers
%undefine _hardened_build
Summary: Xorg X11 v4l video driver Summary: Xorg X11 v4l video driver
Name: xorg-x11-drv-v4l Name: xorg-x11-drv-v4l
Version: 0.3.0 Version: 0.3.0
Release: 10%{?dist} Release: 2%{?dist}
URL: http://www.x.org URL: http://www.x.org
License: MIT License: MIT
Group: User Interface/X Hardware Support
Source0: https://www.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2 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 ExcludeArch: s390 s390x
BuildRequires: make
BuildRequires: xorg-x11-server-devel >= 1.10.99.902 BuildRequires: xorg-x11-server-devel >= 1.10.99.902
BuildRequires: autoconf automake libtool BuildRequires: autoconf automake libtool
@ -24,7 +31,7 @@ Requires: Xorg %([ -e /usr/bin/xserver-sdk-abi-requires ] && xserver-sdk-abi-req
X.Org X11 v4l video driver. X.Org X11 v4l video driver.
%prep %prep
%setup -q -n %{tarball}-%{version} %autosetup -p1 -n %{tarball}-%{version}
%build %build
autoreconf -vif autoreconf -vif
@ -45,34 +52,9 @@ find $RPM_BUILD_ROOT -regex ".*\.la$" | xargs rm -f --
%{_mandir}/man4/v4l.4* %{_mandir}/man4/v4l.4*
%changelog %changelog
* Thu Feb 03 2022 Adam Jackson <ajax@redhat.com> - 0.3.0-10 * Mon Oct 08 2018 Peter Hutterer <peter.hutterer@redhat.com> 0.3.0-2
- Enable hardened build - Fix coverity complaints (#1636829)
Resolves: rhbz#2044900 - Use autosetup
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.0-9
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.3.0-8
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Jan 28 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Nov 5 10:25:27 AEST 2020 Peter Hutterer <peter.hutterer@redhat.com> - 0.3.0-6
- Add BuildRequires for make
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Aug 14 2018 Adam Jackson <ajax@redhat.com> - 0.3.0-1 * Tue Aug 14 2018 Adam Jackson <ajax@redhat.com> - 0.3.0-1
- v4l 0.3.0 - v4l 0.3.0

Loading…
Cancel
Save