[hdparm/f19] fixed division by zero

Michal Minar miminar at fedoraproject.org
Wed Aug 7 07:37:41 UTC 2013


commit 5fa609383f96fd76d9bc1e57a0bf1a4b7709e347
Author: Michal Minar <miminar at redhat.com>
Date:   Wed Aug 7 09:33:31 2013 +0200

    fixed division by zero
    
    Resolves: #986072

 hdparm-9.43-get_geom.patch |   13 +++++++++++++
 hdparm.spec                |    8 +++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/hdparm-9.43-get_geom.patch b/hdparm-9.43-get_geom.patch
new file mode 100644
index 0000000..88414fb
--- /dev/null
+++ b/hdparm-9.43-get_geom.patch
@@ -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;
+ 		}
+ 	}
diff --git a/hdparm.spec b/hdparm.spec
index ac0ab73..7c12764 100644
--- a/hdparm.spec
+++ b/hdparm.spec
@@ -1,7 +1,7 @@
 Summary: A utility for displaying and/or setting hard disk parameters
 Name: hdparm
 Version: 9.43
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: BSD
 Group: Applications/System
 URL:    http://sourceforge.net/projects/hdparm/
@@ -10,6 +10,7 @@ Patch0: hdparm-missing-params.patch
 Patch1: man-page-update.patch
 Patch2: %{name}-9.43-ditch_dead_code.patch
 Patch3: %{name}-9.43-close_fd.patch
+Patch4: %{name}-9.43-get_geom.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 ExcludeArch: s390 s390x
 
@@ -24,6 +25,7 @@ performance and to spin down hard drives for power conservation.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} STRIP=/bin/true LDFLAGS=
@@ -44,6 +46,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/hdparm.8*
 
 %changelog
+* Wed Aug 07 2013 Michal Minar <miminar at redhat.com> 9.43-4
+- Fixed division by zero.
+- Resolves: #986072
+
 * Sun Jul 21 2013 Michal Minar <miminar at redhat.com> 9.43-3
 - Added patches fixing covscan defects.
 


More information about the scm-commits mailing list