import hdparm-9.54-4.el8

This commit is contained in:
CentOS Sources 2021-11-09 05:05:59 -05:00 committed by Stepan Oksanichenko
parent 88db564699
commit dbcbe5ba35
2 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,62 @@
diff -ruN hdparm-9.54/hdparm.c hdparm-9.54/hdparm.c
--- hdparm-9.54/hdparm.c 2021-04-26 15:05:54.000000000 +0100
+++ hdparm-9.54/hdparm.c 2021-05-10 15:58:14.000000000 +0100
@@ -1352,8 +1352,8 @@
if (verbose)
printf("GET_NATIVE_MAX_ADDRESS_EXT response: hob={%02x %02x %02x} lob={%02x %02x %02x}\n",
r.hob.lbah, r.hob.lbam, r.hob.lbal, r.lob.lbah, r.lob.lbam, r.lob.lbal);
- max = (((__u64)((r.hob.lbah << 16) | (r.hob.lbam << 8) | r.hob.lbal) << 24)
- | ((r.lob.lbah << 16) | (r.lob.lbam << 8) | r.lob.lbal)) + 1;
+ max = (((__u64)((r.hob.lbah << 16) | ((__u64)(r.hob.lbam << 8) | r.hob.lbal)) << 24)
+ | (__u64)((r.lob.lbah << 16) | (r.lob.lbam << 8) | r.lob.lbal)) + 1;
}
} else { // ACS2 or below, or optional AMAX not present
if (SUPPORTS_48BIT_ADDR(id)) {
@@ -1371,7 +1371,7 @@
printf("READ_NATIVE_MAX_ADDRESS_EXT response: hob={%02x %02x %02x} lob={%02x %02x %02x}\n",
r.hob.lbah, r.hob.lbam, r.hob.lbal, r.lob.lbah, r.lob.lbam, r.lob.lbal);
max = (((__u64)((r.hob.lbah << 16) | (r.hob.lbam << 8) | r.hob.lbal) << 24)
- | ((r.lob.lbah << 16) | (r.lob.lbam << 8) | r.lob.lbal)) + 1;
+ | ((__u64)(r.lob.lbah << 16) | (r.lob.lbam << 8) | r.lob.lbal)) + 1;
}
} else {
/* DEVICE (3:0) / LBA (27:24) "remap" does NOT apply in ATA Status Return */
@@ -1556,7 +1556,7 @@
for (i = 0; i < nranges; ++i) {
nsectors += sr->nsectors;
range = sr->nsectors;
- range = (range << 48) | sr->lba;
+ range = (__u64)(range << 48) | sr->lba;
data[i] = __cpu_to_le64(range);
++sr;
}
@@ -1742,7 +1742,7 @@
err = errno;
fprintf(stderr, "stdin: error at lba:count pair #%d: %s\n", (total_ranges + 1), strerror(err));
} else {
- range = (nsect << 48) | lba;
+ range = (__u64)(nsect << 48) | lba;
nsectors += nsect;
data[nranges++] = __cpu_to_le64(range);
if (nranges == max_ranges) {
@@ -2807,7 +2807,7 @@
__u16 *dco = get_dco_identify_data(fd, 1);
if (dco) {
__u64 dco_max = dco[5];
- dco_max = ((((__u64)dco[5]) << 32) | (dco[4] << 16) | dco[3]) + 1;
+ dco_max = ((((__u64)dco[5]) << 32) | ((__u64)dco[4] << 16) | (__u64)dco[3]) + 1;
printf("(%llu?)", dco_max);
}
printf(", HPA setting seems invalid");
diff -ruN hdparm-9.61/identify.c hdparm-9.62/identify.c
--- hdparm-9.43/identify.c 2021-04-26 14:47:24.000000000 +0100
+++ hdparm-9.43/identify.c 2021-05-10 15:51:23.000000000 +0100
@@ -1531,7 +1531,7 @@
else if (dco[2] & (1<<0)) printf(" udma0");
putchar('\n');
- lba = ((((__u64)dco[5]) << 32) | (dco[4] << 16) | dco[3]) + 1;
+ lba = ((((__u64)dco[5]) << 32) | ((__u64)dco[4] << 16) | (__u64)dco[3]) + 1;
printf("\tReal max sectors: %llu\n", lba);
printf("\tATA command/feature sets:");

View File

@ -1,7 +1,7 @@
Summary: A utility for displaying and/or setting hard disk parameters
Name: hdparm
Version: 9.54
Release: 3%{?dist}
Release: 4%{?dist}
License: BSD
URL: http://sourceforge.net/projects/%{name}/
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
@ -11,6 +11,7 @@ Patch2: %{name}-9.43-get_geom.patch
Patch3: %{name}-9.54-sysmacros.patch
Patch4: %{name}-9.54-resourceleak-fixes.patch
Patch5: %{name}-9.54-resourceleak-fixes-2.patch
Patch6: %{name}-9.62-dco_max_sector_calculation.patch
%description
Hdparm is a useful system utility for setting (E)IDE hard drive
@ -38,6 +39,9 @@ install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
%{_mandir}/man8/hdparm.8*
%changelog
* Wed May 12 2021 Michal Grzedzicki <mge@fb.com> - 9.54-4
- backport fix for --dco-identify real max sectors calculation from upstream version 9.62 (#1959918)
* Fri Nov 06 2020 Tomas Bzatek <tbzatek@redhat.com> - 9.54-3
- fix invalid pointer free (#1833092)