fixed division by zero

Resolves: #986072
This commit is contained in:
Michal Minar 2013-08-07 09:33:31 +02:00
parent 7afc1e94e2
commit 75da8f6c35
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,13 @@
Index: hdparm-9.43/geom.c
===================================================================
--- hdparm-9.43.orig/geom.c
+++ hdparm-9.43/geom.c
@@ -201,7 +201,7 @@ int get_dev_geometry (int fd, __u32 *cyl
__u64 hs = (*heads) * (*sects);
__u64 cyl = (*cyls);
__u64 chs = cyl * hs;
- if (chs < (*nsectors))
+ if (chs < (*nsectors) && hs)
*cyls = (*nsectors) / hs;
}
}

View File

@ -10,6 +10,7 @@ Patch0: hdparm-missing-params.patch
Patch1: man-page-update.patch Patch1: man-page-update.patch
Patch2: %{name}-9.43-ditch_dead_code.patch Patch2: %{name}-9.43-ditch_dead_code.patch
Patch3: %{name}-9.43-close_fd.patch Patch3: %{name}-9.43-close_fd.patch
Patch4: %{name}-9.43-get_geom.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExcludeArch: s390 s390x ExcludeArch: s390 s390x
@ -24,6 +25,7 @@ performance and to spin down hard drives for power conservation.
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1
%build %build
CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} STRIP=/bin/true LDFLAGS= CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} STRIP=/bin/true LDFLAGS=
@ -44,6 +46,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/hdparm.8* %{_mandir}/man8/hdparm.8*
%changelog %changelog
* Wed Aug 07 2013 Michal Minar <miminar@redhat.com> 9.43-4
- Fixed division by zero.
- Resolves: #986072
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.43-4 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.43-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild