Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
37c79bdf30
!53 libparted: Fix potential NULL dereference in ped_disk
From: @fandeyuan 
Reviewed-by: @volcanodragon 
Signed-off-by: @volcanodragon
2024-03-29 06:34:46 +00:00
fandeyuan
a0a151d6fe libparted: Fix potential NULL dereference in ped_disk 2024-03-29 11:01:43 +08:00
openeuler-ci-bot
b2293a9b69
!33 remove patch which modifid cyl-size
From: @windfine 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-03-07 02:29:35 +00:00
Li Jinlin
659b9e24cd remove patch which modifid cyl-size 2022-03-07 10:10:06 +08:00
openeuler-ci-bot
31aeae3e2a !20 [sync] PR-19: 修复函数接口ped_device_get获取磁盘信息不准确的问题
From: @openeuler-sync-bot
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
2021-05-17 19:32:37 +08:00
wguanghao
bc3aeee3b2 fix end input usage in do_resizepart
(cherry picked from commit 07edf3bee7)
2021-05-17 19:19:42 +08:00
openeuler-ci-bot
696fbd38e5 !16 parted: set release num to 4 for CI
From: @liuzhiqiang26
Reviewed-by: @wubo009
Signed-off-by: @volcanodragon
2021-02-09 18:36:17 +08:00
Zhiqiang Liu
d3bcd0f3ea parted: set release num to 4 for CI
set release num to 4 for CI

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
2021-02-09 10:54:56 +08:00
openeuler-ci-bot
a3bef73105 !11 parted
Merge pull request !11 from 符样清/openEuler-20.03-LTS
2020-06-20 18:57:31 +08:00
fyq_950317
5df90e8a15 add parted.gz.sig file in source tag 2020-06-20 18:21:56 +08:00
4 changed files with 175 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From ca845aeeddb17343c9289816833ca352f7c0d87b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 23 Apr 2019 13:52:25 -0700
Subject: [PATCH] Fix end_input usage in do_resizepart
It needs to be set to NULL, since it may not get set by the call to
command_line_get_sector
---
parted/parted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parted/parted.c b/parted/parted.c
index 9dcdb05..df0c7ed 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1545,6 +1545,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
PedGeometry *range_end = NULL;
PedConstraint* constraint;
int rc = 0;
+ char* end_input = NULL;
if (!disk) {
disk = ped_disk_new (*dev);
@@ -1565,7 +1566,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
start = part->geom.start;
end = oldend = part->geom.end;
- char *end_input;
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
goto error;
_adjust_end_if_iec(&start, &end, range_end, end_input);
--
1.8.3.1

View File

@ -0,0 +1,88 @@
From bfce75fd13dd72c6300f0ac3d739e40df90f7dce Mon Sep 17 00:00:00 2001
From: lixiaokeng <lixiaokeng@huawei.com>
Date: Sun, 7 Jun 2020 15:18:00 +0000
Subject: [PATCH] parted: remove patch which modified cyl size
The cyl size was changed which leaded to "parted /dev/sdb -s mkpart primary 0cyl 128cyl"
could not perform as expected. Remove the patch "Use BLKSSZGET to get device sector size
in _device_probe_geometry()".
Signed-off-by:lixiaokeng<lixiaokeng@huawei.com>
---
linux.c | 52 ++++++++++++++++++----------------------------------
1 file changed, 18 insertions(+), 34 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 37cf555..0d8149d 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -868,7 +868,6 @@ _device_probe_geometry (PedDevice* dev)
struct stat dev_stat;
struct hd_geometry geometry;
int geometry_is_valid = 0;
- int sector_size = 0;
if (!_device_stat (dev, &dev_stat))
return 0;
@@ -880,41 +879,26 @@ _device_probe_geometry (PedDevice* dev)
if (!dev->length)
return 0;
- /* initialize the bios_geom values to something */
- dev->bios_geom.sectors = 0;
- dev->bios_geom.heads = 0;
- dev->bios_geom.cylinders = 0;
-
- geometry_is_valid = !ioctl (arch_specific->fd, HDIO_GETGEO, &geometry)
- && geometry.sectors && geometry.heads;
-
-#if defined __s390__ || defined __s390x__
- if (geometry_is_valid) {
-#else
- if (!ioctl (arch_specific->fd, BLKSSZGET, &sector_size)) {
- /* get the sector count first */
- dev->bios_geom.sectors = 1 + (sector_size / PED_SECTOR_SIZE_DEFAULT);
- dev->bios_geom.heads = 255;
- } else if (geometry_is_valid) {
- /* if BLKSSZGET failed, use deprecated HDIO_GETGEO result */
-#endif
- dev->bios_geom.sectors = geometry.sectors;
- dev->bios_geom.heads = geometry.heads;
+ /* The GETGEO ioctl is no longer useful (as of linux 2.6.x). We could
+ * still use it in 2.4.x, but this is contentious. Perhaps we should
+ * move to EDD. */
+ dev->bios_geom.sectors = 63;
+ dev->bios_geom.heads = 255;
+ dev->bios_geom.cylinders
+ = dev->length / (63 * 255);
+
+ /* FIXME: what should we put here? (TODO: discuss on linux-kernel) */
+ if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry)
+ && geometry.sectors && geometry.heads) {
+ dev->hw_geom.sectors = geometry.sectors;
+ dev->hw_geom.heads = geometry.heads;
+ dev->hw_geom.cylinders
+ = dev->length / (dev->hw_geom.heads
+ * dev->hw_geom.sectors);
} else {
- ped_exception_throw (
- PED_EXCEPTION_WARNING,
- PED_EXCEPTION_OK,
- _("Could not determine sector size for %s: %s.\n"
- "Using the default sector size (%lld)."),
- dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
- dev->bios_geom.sectors = 2;
- dev->bios_geom.heads = 255;
+ dev->hw_geom = dev->bios_geom;
}
- dev->bios_geom.cylinders
- = dev->length / (dev->bios_geom.heads
- * dev->bios_geom.sectors);
- dev->hw_geom = dev->bios_geom;
return 1;
}
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 31db44c74a96f8e2b495205d18525449e9b29543 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 15 Feb 2023 10:13:58 -0800
Subject: [PATCH 19/24] libparted: Fix potential NULL dereference in
ped_disk_next_partition
---
libparted/disk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libparted/disk.c b/libparted/disk.c
index 5aaac5a..405400e 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -1552,8 +1552,11 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part)
return part->part_list ? part->part_list : part->next;
if (part->next)
return part->next;
- if (part->type & PED_PARTITION_LOGICAL)
+ if (part->type & PED_PARTITION_LOGICAL) {
+ if (!ped_disk_extended_partition (disk))
+ return NULL;
return ped_disk_extended_partition (disk)->next;
+ }
return NULL;
}
--
2.33.0

View File

@ -14,9 +14,10 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.3
Release: 2
Release: 7
URL: https://www.gnu.org/software/parted/
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source1: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
License: GPLv3+
BuildRequires: e2fsprogs-devel e2fsprogs xfsprogs readline-devel ncurses-devel gettext-devel python3 gperf
@ -28,6 +29,9 @@ Patch0000: 0000-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch
Patch6000: 6000-add-support-of-gpt_sync_mbr.patch
Patch9000: 9000-Add-extra-judgment-for-a-partition-created-success.patch
Patch9001: 9001-bugfix-parted-fix-failure-of-mklabel-gpt_sync_mbr.patch
Patch9002: 9002-Fix-end_input-usage-in-do_resizepart.patch
Patch9003: 9003-parted-remove-patch-which-modifid-cyl-size.patch
Patch9004: 9004-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch
%description
The GNU Parted program allows you to create, destroy, resize, move,
@ -112,6 +116,24 @@ fi
%{_libdir}/pkgconfig/libparted*.pc
%changelog
* Fri Mar 29 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 3.3-7
- libparted: Fix potential NULL dereference in ped_disk_next_partition
* Tue May 18 2021 wuguanghao<wuguanghao3@huawei.com> - 3.3-6
- remove patch which modifid cyl-size
* Tue Feb 9 2021 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 3.3-5
- fix end input usage in do_resizepart
* Tue Feb 9 2021 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 3.3-4
- set release num to 4 for CI
* Sat Jun 20 2020 fuyangqing<fuyangqing@huawei.com> - 3.3-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: add parted.gz.sig file in source tag
* Sat Mar 14 2020 hy-euler <eulerstoragemt@huawei.com> - 3.3-2
- Type:enhancement
- ID:NA