diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..447ccca
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+SOURCES/thermald-2.4.1.tar.gz
diff --git a/.thermald.metadata b/.thermald.metadata
new file mode 100644
index 0000000..66b77c8
--- /dev/null
+++ b/.thermald.metadata
@@ -0,0 +1 @@
+097a89cbebd1da546ef4af8ea106b9a69f0d712d SOURCES/thermald-2.4.1.tar.gz
diff --git a/SOURCES/0001-adaptive-Fix-missing-initializer.patch b/SOURCES/0001-adaptive-Fix-missing-initializer.patch
new file mode 100644
index 0000000..457332f
--- /dev/null
+++ b/SOURCES/0001-adaptive-Fix-missing-initializer.patch
@@ -0,0 +1,26 @@
+From d51e3d5f78ac0d90d3bf247f1fb61a53fa3b5a71 Mon Sep 17 00:00:00 2001
+From: Benjamin Berg <bberg@redhat.com>
+Date: Thu, 10 Dec 2020 11:35:46 +0100
+Subject: [PATCH 1/3] adaptive: Fix missing initializer
+
+The limit_1_valid attribute was not initialized to zero.
+---
+ src/thd_engine_adaptive.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/thd_engine_adaptive.cpp b/src/thd_engine_adaptive.cpp
+index d84f1ca..4824a9d 100644
+--- a/src/thd_engine_adaptive.cpp
++++ b/src/thd_engine_adaptive.cpp
+@@ -497,6 +497,8 @@ int cthd_engine_adaptive::parse_ppcc(char *name, char *buf, int len) {
+ 	if (ppcc.power_limit_1_max && ppcc.power_limit_1_min && ppcc.time_wind_1_min
+ 			&& ppcc.time_wind_1_max && ppcc.step_1_size)
+ 		ppcc.limit_1_valid = 1;
++	else
++		ppcc.limit_1_valid = 0;
+ 
+ 	ppccs.push_back(ppcc);
+ 
+-- 
+2.26.2
+
diff --git a/SOURCES/0002-adaptive-Fix-use-after-free.patch b/SOURCES/0002-adaptive-Fix-use-after-free.patch
new file mode 100644
index 0000000..d76138d
--- /dev/null
+++ b/SOURCES/0002-adaptive-Fix-use-after-free.patch
@@ -0,0 +1,31 @@
+From a10d4ddeb8b55e238289d63a2623b8936eb6bda4 Mon Sep 17 00:00:00 2001
+From: Benjamin Berg <bberg@redhat.com>
+Date: Thu, 10 Dec 2020 11:36:43 +0100
+Subject: [PATCH 2/3] adaptive: Fix use-after-free
+
+The debug logging would access a recently free'ed variable. Fix this by
+changing the order.
+---
+ src/thd_engine_adaptive.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/thd_engine_adaptive.cpp b/src/thd_engine_adaptive.cpp
+index 4824a9d..b68cc40 100644
+--- a/src/thd_engine_adaptive.cpp
++++ b/src/thd_engine_adaptive.cpp
+@@ -692,10 +692,11 @@ int cthd_engine_adaptive::parse_gddv_key(char *buf, int size, int *end_offset) {
+ 
+ 	str = strtok(key, "/");
+ 	if (!str) {
++		thd_log_debug("Ignoring key %s\n", key);
++
+ 		delete[] (key);
+ 		delete[] (val);
+ 
+-		thd_log_debug("Ignoring key %s\n", key);
+ 		/* Ignore */
+ 		return THD_SUCCESS;
+ 	}
+-- 
+2.26.2
+
diff --git a/SOURCES/0003-adaptive-Remove-useless-NULL-check.patch b/SOURCES/0003-adaptive-Remove-useless-NULL-check.patch
new file mode 100644
index 0000000..f186db9
--- /dev/null
+++ b/SOURCES/0003-adaptive-Remove-useless-NULL-check.patch
@@ -0,0 +1,27 @@
+From 268349088e0931421da65f4dce6997f197a10b12 Mon Sep 17 00:00:00 2001
+From: Benjamin Berg <bberg@redhat.com>
+Date: Thu, 10 Dec 2020 11:37:27 +0100
+Subject: [PATCH 3/3] adaptive: Remove useless NULL check
+
+_zone cannot be NULL in update_engine_state. Remove a useless check that
+would have caused a crash earlier already.
+---
+ src/thd_engine_adaptive.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/thd_engine_adaptive.cpp b/src/thd_engine_adaptive.cpp
+index b68cc40..bc16ad2 100644
+--- a/src/thd_engine_adaptive.cpp
++++ b/src/thd_engine_adaptive.cpp
+@@ -1454,7 +1454,7 @@ void cthd_engine_adaptive::update_engine_state() {
+ 				_zone->zone_reset(1);
+ 				_zone->trip_delete_all();
+ 
+-				if (_zone && _zone->zone_active_status())
++				if (_zone->zone_active_status())
+ 					_zone->set_zone_inactive();
+ 			}
+ 
+-- 
+2.26.2
+
diff --git a/SPECS/thermald.spec b/SPECS/thermald.spec
new file mode 100644
index 0000000..7f977f6
--- /dev/null
+++ b/SPECS/thermald.spec
@@ -0,0 +1,327 @@
+# Explicitly turn on hardening, if required.
+%if 0%{?rhel} && 0%{?rhel} <= 7
+%global _hardened_build 1
+%endif
+
+%global pkgname thermal_daemon
+
+
+Name:		thermald
+Version:	2.4.1
+Release:	2%{?dist}
+Summary:	Thermal Management daemon
+
+License:	GPLv2+
+URL:		https://github.com/intel/%{pkgname}
+Source0:	%{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+
+# No cpuid.h on other arches.
+ExclusiveArch:	%{ix86} x86_64
+
+BuildRequires:	autoconf autoconf-archive
+BuildRequires:	automake
+BuildRequires:	dbus-glib-devel
+BuildRequires:	desktop-file-utils
+BuildRequires:	gcc-c++
+BuildRequires:	libxml2-devel
+BuildRequires:	systemd-devel
+BuildRequires:  upower-devel
+BuildRequires:  libevdev-devel
+BuildRequires:  gtk-doc
+
+Requires:	dbus%{?_isa}
+
+Requires(pre):	glibc-common
+Requires(pre):	shadow-utils
+
+%{?systemd_requires}
+
+# https://github.com/intel/thermal_daemon/pull/286
+Patch0001:	0001-adaptive-Fix-missing-initializer.patch
+Patch0002:	0002-adaptive-Fix-use-after-free.patch
+Patch0003:	0003-adaptive-Remove-useless-NULL-check.patch
+
+
+%description
+%{name} monitors and controls platform temperature.
+
+Thermal issues are important to handle proactively to reduce performance
+impact.  %{name} uses the existing Linux kernel infrastructure and can
+be easily enhanced.
+
+
+%package monitor
+Summary:	Application for monitoring %{name}
+License:	GPLv3+
+
+BuildRequires:	qt5-qtbase-devel
+
+Requires:	hicolor-icon-theme
+Requires:	%{name}%{?_isa}		== %{version}-%{release}
+
+%description monitor
+This package contains an Application to monitor %{name} for system
+developers who want to enable application developers and their
+customers with the responsive and flexible thermal management,
+supporting optimal performance in desktop, clam-shell, mobile and
+embedded devices.
+
+
+%prep
+%autosetup -n %{pkgname}-%{version} -p 1
+
+# Create tmpfiles.d config.
+%{__mkdir} -p fedora_addons
+%{__cat} << EOF > fedora_addons/%{name}.conf
+d %{_rundir}/%{name} 0755 root root -
+EOF
+
+# Create desktop-file for the monitor-app.
+%{__cat} << EOF > fedora_addons/%{name}-monitor.desktop
+[Desktop Entry]
+Name=%{name} Monitor
+Comment=Application for monitoring %{name}
+Icon=%{name}-monitor
+Categories=System;Settings;
+Exec=%{_bindir}/ThermalMonitor
+Type=Application
+StartupNotify=true
+Terminal=false
+EOF
+
+# Create icon for the monitor-app.
+%{__cat} << EOF > fedora_addons/%{name}-monitor.svg
+<?xml version="1.0" encoding="iso-8859-1"?>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
+<path style="fill:#EFEFEF;" d="M501.106,256c0,33.661-6.787,65.732-19.064,94.927L256,239.66L29.957,350.927
+	C17.68,321.732,10.894,289.661,10.894,256C10.894,120.636,120.636,10.894,256,10.894S501.106,120.636,501.106,256z"/>
+<path style="fill:#F15A29;" d="M430.294,256c0,22.43-4.238,43.869-11.961,63.564l-96.202-47.355c1.264-5.196,1.95-10.621,1.95-16.21
+	c0-18.802-7.626-35.818-19.935-48.15l75.101-75.101C410.783,164.298,430.294,207.872,430.294,256z"/>
+<path style="fill:#FBA026;" d="M418.332,319.564c-25.393,64.828-88.5,110.734-162.337,110.734
+	c-73.826,0-136.933-45.895-162.337-110.723C85.935,299.879,81.698,278.43,81.698,256c0-96.256,78.042-174.298,174.298-174.298
+	c48.128,0,91.702,19.51,123.25,51.047l-75.101,75.101c12.31,12.332,19.935,29.347,19.935,48.15c0,5.588-0.686,11.013-1.95,16.21
+	L418.332,319.564z"/>
+<path style="fill:#27AAE1;" d="M482.038,350.927c-37.093,88.227-124.34,150.179-226.043,150.179S67.046,439.154,29.953,350.927
+	l63.706-31.352l96.212-47.365c-1.264-5.196-1.961-10.621-1.961-16.21c0-37.605,30.491-68.085,68.085-68.085
+	c18.802,0,35.818,7.626,48.15,19.935c12.31,12.332,19.935,29.347,19.935,48.15c0,5.588-0.686,11.013-1.95,16.21l96.202,47.355
+	L482.038,350.927z"/>
+<circle style="fill:#EFEFEF;" cx="256" cy="256" r="21.787"/>
+<g>
+	<path style="fill:#231F20;" d="M191.566,307.802l-77.373,38.086c-5.398,2.657-7.62,9.187-4.963,14.584
+		c1.895,3.851,5.762,6.085,9.781,6.085c1.614,0,3.255-0.362,4.802-1.122l77.373-38.087c5.398-2.657,7.62-9.187,4.963-14.584
+		C203.495,307.369,196.965,305.147,191.566,307.802z"/>
+	<path style="fill:#231F20;" d="M245.106,457.532c0,6.017,4.878,10.894,10.894,10.894c28.936,0,57.027-5.721,83.495-17.005
+		c26.031-11.098,49.226-27.021,68.936-47.325c4.192-4.316,4.088-11.213-0.228-15.405c-4.317-4.19-11.213-4.087-15.405,0.229
+		c-36.133,37.22-84.715,57.719-136.799,57.719C249.985,446.638,245.106,451.515,245.106,457.532z"/>
+	<path style="fill:#231F20;" d="M415.931,379.26c1.884,1.293,4.028,1.912,6.153,1.912c3.47,0,6.88-1.655,8.993-4.731l0.15-0.219
+		c3.403-4.961,2.142-11.742-2.82-15.145c-4.958-3.403-11.74-2.142-15.145,2.819l-0.15,0.219
+		C409.708,369.076,410.969,375.856,415.931,379.26z"/>
+	<path style="fill:#231F20;" d="M288.681,256.002c0-18.02-14.661-32.681-32.681-32.681s-32.681,14.661-32.681,32.681
+		S237.98,288.683,256,288.683S288.681,274.022,288.681,256.002z M245.106,256.002c0-6.007,4.887-10.894,10.894-10.894
+		c6.007,0,10.894,4.887,10.894,10.894c0,6.007-4.887,10.894-10.894,10.894C249.993,266.896,245.106,262.009,245.106,256.002z"/>
+	<path style="fill:#231F20;" d="M512,256c0-68.378-26.628-132.665-74.982-181.017S324.379,0,256,0
+		C187.622,0,123.335,26.629,74.982,74.983C26.629,123.335,0,187.622,0,256c0,34.321,6.685,67.638,19.868,99.032
+		c0.015,0.039,0.026,0.078,0.042,0.118C59.97,450.433,152.639,512,255.996,512s196.025-61.567,236.085-156.851
+		c0,0,0-0.001,0.001-0.002l0.002,0.003C505.299,323.726,512,290.367,512,256z M255.996,490.213
+		c-91.135,0-173.186-52.313-211.823-134.142l150.511-74.087c4.58-2.255,6.98-7.387,5.774-12.348
+		c-1.097-4.507-1.653-9.095-1.653-13.636c0-31.536,25.657-57.191,57.191-57.191c15.265,0,29.632,5.949,40.44,16.738
+		c10.802,10.822,16.751,25.188,16.751,40.453c0,4.57-0.552,9.157-1.642,13.636c-1.206,4.961,1.194,10.094,5.775,12.348
+		l150.499,74.086C429.182,437.898,347.131,490.213,255.996,490.213z M92.591,256c0-90.101,73.303-163.404,163.404-163.404
+		c39.988,0,77.792,14.274,107.592,40.406l-59.981,59.984c-13.652-10.349-30.203-15.964-47.611-15.964
+		c-43.549,0-78.979,35.429-78.979,78.979c0,3.354,0.218,6.721,0.651,10.076l-77.795,38.292
+		C95.042,288.781,92.591,272.563,92.591,256z M378.993,148.407C405.126,178.206,419.4,216.011,419.4,256
+		c0,16.559-2.443,32.779-7.276,48.367l0.001,0.002l-77.797-38.297c0.43-3.344,0.646-6.712,0.646-10.072
+		c0-17.413-5.618-33.97-15.981-47.631l0.031,0.01L378.993,148.407z M431.875,314.091c6.176-18.676,9.312-38.169,9.312-58.091
+		c0-45.811-16.535-89.081-46.766-123.018l5.449-5.448c4.254-4.254,4.254-11.152,0-15.406c-4.253-4.254-11.149-4.254-15.407,0
+		l-5.449,5.449c-33.938-30.232-77.207-46.768-123.018-46.768C153.881,70.809,70.804,153.885,70.804,256
+		c0,19.926,3.134,39.421,9.309,58.095L35.774,335.92c-9.286-25.546-13.986-52.377-13.986-79.92
+		C21.787,126.855,126.854,21.787,256,21.787S490.213,126.855,490.213,256c0,27.547-4.701,54.378-13.987,79.922l0.002,0.003
+		L431.875,314.091z"/>
+</g>
+</svg>
+EOF
+
+# Create ReadMe.txt for the monitor-app.
+%{__cat} << EOF > fedora_addons/%{name}-monitor.ReadMe.txt
+Running the thermald-monitor-app
+--------------------------------
+
+To communicate with thermald via dbus, the user has to be member
+of the "power" group.  So make sure to add your user id to this
+group before using the thermald-monitor-app.
+EOF
+
+NO_CONFIGURE=1 ./autogen.sh
+
+
+%build
+%configure									\
+	--disable-option-checking						\
+	--disable-silent-rules
+
+%make_build
+
+# Build the monitor-app.
+pushd tools/thermal_monitor
+%{__mkdir} -p %{_target_platform}
+pushd %{_target_platform}
+%{qmake_qt5} ..
+%make_build
+popd
+popd
+
+
+%install
+%make_install
+
+# Install management-script.
+%{__install} -Dpm 0755 tools/thermald_set_pref.sh				\
+	%{buildroot}%{_bindir}/%{name}-set-pref
+
+# DBus config belongs into %%{_datadir}.
+%{__mkdir} -p %{buildroot}%{_datadir}
+%{__mv} -f %{buildroot}%{_sysconfdir}/dbus-1/* %{buildroot}%{_datadir}/dbus-1/
+
+# No Upstart.
+%{__rm} -fr %{buildroot}%{_sysconfdir}/init
+
+# Setup tmpfiles.d
+%{__install} -Dpm 0644 fedora_addons/%{name}.conf				\
+	%{buildroot}%{_tmpfilesdir}/%{name}.conf
+%{__install} -dm 0755 %{buildroot}%{_rundir}/%{name}
+/bin/echo "%{name}_pid" > %{buildroot}%{_rundir}/%{name}/%{name}.pid
+%{__chmod} -c 0644 %{buildroot}%{_rundir}/%{name}/%{name}.pid
+
+# Install the monitor-app.
+%{__install} -Dpm 0755 tools/thermal_monitor/%{_target_platform}/ThermalMonitor	\
+	%{buildroot}%{_bindir}/ThermalMonitor
+%{__install} -Dpm 0644 fedora_addons/%{name}-monitor.desktop			\
+	%{buildroot}%{_datadir}/applications/%{name}-monitor.desktop
+%{__install} -Dpm 0644 fedora_addons/%{name}-monitor.svg			\
+	%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}-monitor.svg
+
+
+%check
+%{_bindir}/desktop-file-validate						\
+	%{buildroot}%{_datadir}/applications/*.desktop
+
+
+%pre
+/bin/getent group power >/dev/null || /sbin/groupadd -r power
+exit 0
+
+
+%post
+%systemd_post thermald.service
+
+
+%preun
+%systemd_preun thermald.service
+
+
+%postun
+%systemd_postun_with_restart thermald.service
+
+%files
+%config(noreplace) %{_sysconfdir}/%{name}
+%doc README.txt thermal_daemon_usage.txt
+%ghost %dir %{_rundir}/%{name}
+%ghost %{_rundir}/%{name}/%{name}.pid
+%license COPYING
+%{_bindir}/%{name}-set-pref
+%{_datadir}/dbus-1/system-services/org.freedesktop.%{name}.service
+%{_datadir}/dbus-1/system.d/org.freedesktop.%{name}.conf
+%{_mandir}/man5/thermal-conf.xml.5*
+%{_mandir}/man8/%{name}.8*
+%{_sbindir}/%{name}
+%{_tmpfilesdir}/%{name}.conf
+%{_unitdir}/%{name}.service
+
+
+%files monitor
+%doc fedora_addons/%{name}-monitor.ReadMe.txt
+%license tools/thermal_monitor/qcustomplot/GPL.txt
+%{_bindir}/ThermalMonitor
+%{_datadir}/applications/%{name}-monitor.desktop
+%{_datadir}/icons/hicolor/scalable/apps/%{name}-monitor.svg
+
+
+%changelog
+* Thu Dec 10 2020 Benjamin Berg <bberg@redhat.com> - 2.4.1-2
+- Fix problems reported by coverity
+  Related: #1875505
+
+* Tue Dec 08 2020 Benjamin Berg <bberg@redhat.com> - 2.4.1-1
+- Update to thermald 2.4.1
+  Resolves: #1875505
+
+* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
+
+* Wed Dec 18 2019 Benjamin Berg <bberg@redhat.com> - 1.9.1-1
+- New upstream release 1.9 (rhbz#1782249)
+- Drop Patch0, it has been merged upstream
+
+* Fri Sep 20 2019 Christian Kellner <ckellner@redhat.com> - 1.9-1
+- New upstream release 1.9 (rhbz#1742290)
+- Update patch0 (taken from upstream, commit dcdaf52...)
+
+* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
+
+* Fri May 17 2019 Benjamin Berg <bberg@redhat.com> - 1.8-2
+- Fix build on i686
+
+* Fri May 17 2019 Benjamin Berg <bberg@redhat.com> - 1.8-1
+- New upstream release (#1582506)
+
+* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
+
+* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
+
+* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
+
+* Thu Dec 28 2017 Björn Esser <besser82@fedoraproject.org> - 1.7.1-1
+- New upstream release (#1505144)
+
+* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-8
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-7
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Sat Jul 01 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-6
+- Add upstreamed patch to silence compiler warnings
+
+* Sat Jul 01 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-5
+- Replace fix for rhbz#1464548 from upstream commit
+- Add upstream patch to fix README
+
+* Fri Jun 30 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-4
+- Add upstream patch to fix ThermalMonitor (rhbz#1464548)
+- Add several fixes from upstream
+
+* Tue Apr 11 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-3
+- Explicitly turn on hardening, if required
+
+* Tue Apr 11 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-2
+- Fix missing trailing semicolon in desktop-file
+
+* Tue Apr 11 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-1
+- Initial import (rhbz#1440406)
+
+* Mon Apr 10 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.4
+- Use qmake_qt5-macro and build out of tree
+
+* Sat Apr 08 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.3
+- Small packaging improvements
+
+* Sat Apr 08 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.2
+- Add management-script
+
+* Sat Apr 08 2017 Björn Esser <besser82@fedoraproject.org> - 1.6-0.1
+- Initial rpm-release (rhbz#1440406)