Compare commits

...

No commits in common. "c8" and "c9" have entirely different histories.
c8 ... c9

7 changed files with 79 additions and 116 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/hdparm-9.54.tar.gz
SOURCES/hdparm-9.62.tar.gz

View File

@ -1 +1 @@
54db6430645be2570e0fe4babd6d0ecfb765cc40 SOURCES/hdparm-9.54.tar.gz
100b9a5551b71d87b446b415d56c5d45ac41d131 SOURCES/hdparm-9.62.tar.gz

View File

@ -1,24 +0,0 @@
Index: hdparm-9.54/geom.c
===================================================================
--- hdparm-9.54.orig/geom.c
+++ hdparm-9.54/geom.c
@@ -18,6 +18,7 @@
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/fs.h>
+#include <sys/sysmacros.h>
#include "hdparm.h"
Index: hdparm-9.54/sysfs.c
===================================================================
--- hdparm-9.54.orig/sysfs.c
+++ hdparm-9.54/sysfs.c
@@ -16,6 +16,7 @@
#include <limits.h>
#include <sys/stat.h>
#include <linux/types.h>
+#include <sys/sysmacros.h>
#include "hdparm.h"

View File

@ -1,7 +1,6 @@
Index: hdparm-9.43/sgio.c
===================================================================
--- hdparm-9.43.orig/sgio.c
+++ hdparm-9.43/sgio.c
diff -up hdparm-9.60/sgio.c.bak hdparm-9.60/sgio.c
--- hdparm-9.60/sgio.c.bak 2019-01-03 23:37:54.000000000 +0100
+++ hdparm-9.60/sgio.c 2021-04-07 16:10:36.971836569 +0200
@@ -17,6 +17,10 @@
#include <linux/hdreg.h>
@ -22,7 +21,7 @@ Index: hdparm-9.43/sgio.c
if (tf->command == ATA_OP_PIDENTIFY)
prefer12 = 0;
@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc
@@ -306,14 +310,16 @@ int sg16 (int fd, int rw, int dma, struc
desc = sb + 8;
if (io_hdr.driver_status != SG_DRIVER_SENSE) {
@ -44,4 +43,4 @@ Index: hdparm-9.43/sgio.c
+#endif
}
} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));
if (verbose || tf->command != ATA_OP_IDENTIFY)

View File

@ -0,0 +1,13 @@
diff -up hdparm-9.60/sysfs.c.bak hdparm-9.60/sysfs.c
--- hdparm-9.60/sysfs.c.bak 2021-04-15 15:48:56.806354847 +0200
+++ hdparm-9.60/sysfs.c 2021-04-16 14:44:42.520395436 +0200
@@ -61,7 +61,8 @@ static int sysfs_write_attr (char *path,
if (count < 0)
err = errno;
}
- fclose(fp);
+ if (fp)
+ fclose(fp);
if (err && verbose) perror(path);
*pathtail = '\0';
return err;

View File

@ -1,62 +0,0 @@
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,17 +1,21 @@
Summary: A utility for displaying and/or setting hard disk parameters
Name: hdparm
Version: 9.54
Release: 4%{?dist}
Version: 9.62
Release: 2%{?dist}
License: BSD
URL: http://sourceforge.net/projects/%{name}/
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Patch0: %{name}-9.43-ditch_dead_code.patch
URL: https://sourceforge.net/projects/%{name}/
Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Patch0: %{name}-9.60-ditch_dead_code.patch
Patch1: %{name}-9.43-close_fd.patch
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
Patch3: %{name}-9.54-resourceleak-fixes.patch
Patch4: %{name}-9.54-resourceleak-fixes-2.patch
Patch5: %{name}-9.60-sysfs-fclose.patch
BuildRequires: gcc
BuildRequires: make
Provides: /sbin/hdparm
%description
Hdparm is a useful system utility for setting (E)IDE hard drive
@ -25,30 +29,63 @@ performance and to spin down hard drives for power conservation.
CFLAGS="$RPM_OPT_FLAGS" %make_build STRIP=/bin/true LDFLAGS="$RPM_LD_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
install -c -m 755 hdparm $RPM_BUILD_ROOT/sbin/hdparm
install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
install -c -m 755 hdparm $RPM_BUILD_ROOT%{_sbindir}/hdparm
install -c -m 644 hdparm.8 $RPM_BUILD_ROOT%{_mandir}/man8
%files
%doc hdparm.lsm Changelog README.acoustic TODO
%license LICENSE.TXT
/sbin/hdparm
%{_sbindir}/hdparm
%{_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)
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 9.62-2
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Nov 06 2020 Tomas Bzatek <tbzatek@redhat.com> - 9.54-3
- fix invalid pointer free (#1833092)
* Thu May 20 2021 Tomas Bzatek <tbzatek@redhat.com> - 9.62-1
- New upstream version 9.62 (#1961841)
* Thu Oct 04 2018 Karsten Hopp <karsten@redhat.com> - 9.54-2
- fix resource leaks
* Fri Apr 16 2021 Tomas Bzatek <tbzatek@redhat.com> - 9.60-4
- Fix fclose() on sysfs file write
* Thu Mar 15 2018 Michal Minář miminar@redhat.com - 9.54-1
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 9.60-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Apr 15 2021 Tomas Bzatek <tbzatek@redhat.com> - 9.60-2
- Move hdparm binary to /usr/sbin
* Fri Apr 09 2021 Tomas Bzatek <tbzatek@redhat.com> - 9.60-1
- New upstream version 9.60 (#1947860)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 9.58-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 9.58-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 9.58-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 9.58-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon May 20 2019 Michal Minář <miminar@redhat.com> - 9.58-1
- New upstream version 9.58
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 9.56-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jul 23 2018 Michal Minář <miminar@redhat.com> - 9.56-1
- New upstream version.
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 9.54-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Mar 15 2018 Michal Minář <miminar@redhat.com> - 9.54-1
- New upstream version 9.54
* Fri Feb 23 2018 Florian Weimer <fweimer@redhat.com> - 9.52-3