From: Akinobu Mita Date: Mon, 26 Aug 2013 13:08:40 +0000 (+0900) Subject: [SCSI] scsi_debug: fix endianness bug in sdebug_build_parts() X-Git-Tag: firefly_0821_release~176^2~5295^2~52 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=150c3544b1d317fe32b1f279917c08638dad363f;p=firefly-linux-kernel-4.4.55.git [SCSI] scsi_debug: fix endianness bug in sdebug_build_parts() With module parameter num_parts > 0, partition table is built on the ramdisk storage when loading the driver. Unfortunately, there is an endianness bug in sdebug_build_parts(). So the partition table is not correctly initialized on big-endian systems. Signed-off-by: Akinobu Mita Tested-by: Martin Peschke Acked-by: Douglas Gilbert Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index cb4fefa1bfba..2f39b13c7130 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -2659,8 +2659,8 @@ static void __init sdebug_build_parts(unsigned char *ramp, / sdebug_sectors_per; pp->end_sector = (end_sec % sdebug_sectors_per) + 1; - pp->start_sect = start_sec; - pp->nr_sects = end_sec - start_sec + 1; + pp->start_sect = cpu_to_le32(start_sec); + pp->nr_sects = cpu_to_le32(end_sec - start_sec + 1); pp->sys_ind = 0x83; /* plain Linux partition */ } }