diff options
| author | Len Brown <len.brown@intel.com> | 2011-03-23 02:33:54 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2011-03-23 02:33:54 -0400 |
| commit | 5c129a8600100a5d0f5fdbc1014c5dba1d307bc4 (patch) | |
| tree | 9877a14b49cff43d0ba10c12f407ec551c77daa5 /fs/partitions/osf.c | |
| parent | 797b10a07069e153d41aedb4ae8e76660279e2ee (diff) | |
| parent | 521cb40b0c44418a4fd36dc633f575813d59a43d (diff) | |
Merge commit 'v2.6.38' into release
Diffstat (limited to 'fs/partitions/osf.c')
| -rw-r--r-- | fs/partitions/osf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/partitions/osf.c b/fs/partitions/osf.c index 48cec7cbca1..be03a0b08b4 100644 --- a/fs/partitions/osf.c +++ b/fs/partitions/osf.c @@ -10,10 +10,13 @@ #include "check.h" #include "osf.h" +#define MAX_OSF_PARTITIONS 8 + int osf_partition(struct parsed_partitions *state) { int i; int slot = 1; + unsigned int npartitions; Sector sect; unsigned char *data; struct disklabel { @@ -45,7 +48,7 @@ int osf_partition(struct parsed_partitions *state) u8 p_fstype; u8 p_frag; __le16 p_cpg; - } d_partitions[8]; + } d_partitions[MAX_OSF_PARTITIONS]; } * label; struct d_partition * partition; @@ -63,7 +66,12 @@ int osf_partition(struct parsed_partitions *state) put_dev_sector(sect); return 0; } - for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) { + npartitions = le16_to_cpu(label->d_npartitions); + if (npartitions > MAX_OSF_PARTITIONS) { + put_dev_sector(sect); + return 0; + } + for (i = 0 ; i < npartitions; i++, partition++) { if (slot == state->limit) break; if (le32_to_cpu(partition->p_size)) |
