Commit 76540ee0 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] fix signed/unsigned issue in SGI partitioning code

The Linux code for SGI partitions uses an int instead of an unsigned int
in the ondisk structure in two places, which breaks > TB partitions.

While porting the code over from an internal 2.4-based tree I've also
switched it to use the explicit uXX/sXX types everywhere and moved the
struct defintions above sgi_partition().
parent 235b9607
......@@ -7,31 +7,33 @@
#include "check.h"
#include "sgi.h"
struct sgi_disklabel {
s32 magic_mushroom; /* Big fat spliff... */
s16 root_part_num; /* Root partition number */
s16 swap_part_num; /* Swap partition number */
s8 boot_file[16]; /* Name of boot file for ARCS */
u8 _unused0[48]; /* Device parameter useless crapola.. */
struct sgi_volume {
s8 name[8]; /* Name of volume */
s32 block_num; /* Logical block number */
s32 num_bytes; /* How big, in bytes */
} volume[15];
struct sgi_partition {
u32 num_blocks; /* Size in logical blocks */
u32 first_block; /* First logical block */
s32 type; /* Type of this partition */
} partitions[16];
s32 csum; /* Disk label checksum */
s32 _unused1; /* Padding */
};
int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
{
int i, csum, magic;
int slot = 1;
unsigned int *ui, start, blocks, cs;
Sector sect;
struct sgi_disklabel {
int magic_mushroom; /* Big fat spliff... */
short root_part_num; /* Root partition number */
short swap_part_num; /* Swap partition number */
char boot_file[16]; /* Name of boot file for ARCS */
unsigned char _unused0[48]; /* Device parameter useless crapola.. */
struct sgi_volume {
char name[8]; /* Name of volume */
int block_num; /* Logical block number */
int num_bytes; /* How big, in bytes */
} volume[15];
struct sgi_partition {
int num_blocks; /* Size in logical blocks */
int first_block; /* First logical block */
int type; /* Type of this partition */
} partitions[16];
int csum; /* Disk label checksum */
int _unused1; /* Padding */
} *label;
struct sgi_disklabel *label;
struct sgi_partition *p;
label = (struct sgi_disklabel *) read_dev_sector(bdev, 0, &sect);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment