diff options
author | Karel Zak | 2015-04-22 11:08:05 +0200 |
---|---|---|
committer | Karel Zak | 2015-04-22 11:08:05 +0200 |
commit | 40b175084ff4c57468fb67600c8c66703e17cd75 (patch) | |
tree | 25ed8dc26b4afc906bfcc1e58c6be37b687f6eea /disk-utils/partx.c | |
parent | fdisk, sfdisk: fix -o <list> backend (diff) | |
download | kernel-qcow2-util-linux-40b175084ff4c57468fb67600c8c66703e17cd75.tar.gz kernel-qcow2-util-linux-40b175084ff4c57468fb67600c8c66703e17cd75.tar.xz kernel-qcow2-util-linux-40b175084ff4c57468fb67600c8c66703e17cd75.zip |
lib/strutils: fix string_add_to_idarray() int vs. size_t
The function uses "int" as argument, but for array size (and index) is better
to use unsigned type (size_t). If we mix "size_t" in util (e.g. fdisk)
and "int" in lib/strutils.c then result is unexpected behavior on
ppc64.
# sfdisk --list -o DEVICE,START,SIZE /dev/sdb
Disk /dev/sdb: 50 MiB, 52428800 bytes, 102400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 32768 bytes
Disklabel type: gpt
Disk identifier: 3B8559DB-33AF-43E9-BEFC-C331D829B539
lt-sfdisk: libfdisk/src/label.c:178: fdisk_label_get_field: Assertion `id > 0' failed.
The patch cleanup all code to use size_t everywhere.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/partx.c')
-rw-r--r-- | disk-utils/partx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/disk-utils/partx.c b/disk-utils/partx.c index f21c388a7..ffc74d698 100644 --- a/disk-utils/partx.c +++ b/disk-utils/partx.c @@ -99,7 +99,8 @@ struct colinfo infos[] = { #define NCOLS ARRAY_SIZE(infos) /* array with IDs of enabled columns */ -static int columns[NCOLS], ncolumns; +static int columns[NCOLS]; +size_t ncolumns; static int verbose; static int partx_flags; |