hdparm/hdparm-9.43-get_geom.patch
Michal Minar 75da8f6c35 fixed division by zero
Resolves: #986072
2013-08-07 09:40:11 +02:00

14 lines
394 B
Diff

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;
}
}