Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 308773 Details for
Bug 209968
parted should not create dos partitions >2TB
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Prevent creating dos partitions > 2TB
parted-1.6.19-2TB-limit.patch (text/plain), 2.86 KB, created by
John Newbigin
on 2008-06-10 05:57:12 UTC
(
hide
)
Description:
Prevent creating dos partitions > 2TB
Filename:
MIME Type:
Creator:
John Newbigin
Created:
2008-06-10 05:57:12 UTC
Size:
2.86 KB
patch
obsolete
>--- parted-1.6.19/libparted/disk.c.2tb 2004-11-19 14:37:34.000000000 -1000 >+++ parted-1.6.19/libparted/disk.c 2008-03-14 14:20:44.000000000 -1000 >@@ -32,6 +32,8 @@ > #endif /* ENABLE_NLS */ > > #include <string.h> >+#include <stdint.h> >+#include <limits.h> > > /* UPDATE MODE functions */ > #ifdef DEBUG >@@ -1385,6 +1387,34 @@ > return 1; > } > >+static PedSector >+_partition_max_start (char const *label_type) >+{ >+ /* List partition table names (a la disk->type->name) for which >+ the partition length, in sectors, must fit in 32 bytes. */ >+ static char const *const max_32[] = {"msdos", "dvh"}; >+ unsigned int i; >+ >+ for (i = 0; i < sizeof max_32 / sizeof *max_32; i++) >+ if (strcmp (label_type, max_32[i]) == 0) >+ return UINT32_MAX; >+ >+ if ((PedSector) (!(!((PedSector) 0 < (PedSector) -1)))) >+ return (PedSector) -1; >+ else >+ return ~(~(PedSector) 0 << (sizeof(PedSector) * CHAR_BIT-1)); >+} >+ >+static PedSector >+_partition_max_len (char const *label_type) >+{ >+ /* NOTE: for now, they happen to be the same, so don't duplicate >+ needlessly. Of course, if there's some format with different >+ length and starting sector limits, then these functions will >+ diverge. */ >+ return _partition_max_start (label_type); >+} >+ > static int > _check_partition (PedDisk* disk, PedPartition* part) > { >@@ -1423,6 +1453,45 @@ > return 0; > } > >+ if (!(part->type & PED_PARTITION_METADATA)) { >+ char const *label_type = disk->type->name; >+ /* Enforce some restrictions inherent in the DOS partition >+ table format. Without these, one would be able to create >+ a 2TB partition (or larger), and it would work, but only >+ until the next reboot. This was insidious: the too-large >+ partition would work initially, because with Linux-2.4.x >+ and newer we set the partition start sector and length >+ (in sectors) accurately and directly via the BLKPG ioctl. >+ However, only the last 32 bits of each number would be >+ written to the partition table, and the next time the >+ system would read/use those corrupted numbers it would >+ usually complain about an invalid partition. >+ The same applies to the starting sector number. */ >+ >+ if (part->geom.length > _partition_max_len (label_type)) { >+ ped_exception_throw ( >+ PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, >+ _("partition length of %jd sectors exceeds the " >+ "%s-partition-table-imposed maximum of %jd"), >+ part->geom.length, >+ label_type, >+ _partition_max_len (label_type)); >+ return 0; >+ } >+ >+ /* The starting sector number must fit in 32 bytes. */ >+ if (part->geom.start > _partition_max_start (label_type)) { >+ ped_exception_throw ( >+ PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, >+ _("starting sector number, %jd exceeds the" >+ " %s-partition-table-imposed maximum of %jd"), >+ part->geom.start, >+ label_type, >+ _partition_max_start (label_type)); >+ return 0; >+ } >+ } >+ > return 1; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 209968
:
298107
| 308773