Re: [PATCH 2/5] scsi: megaraid_sas - added bios_param in scsi_host_template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 06 Feb 2007 13:57:23 -0800
Sumant Patro <sumantp@xxxxxxxx> wrote:

> +static int
> +megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
> +		 sector_t capacity, int geom[])
> +{
> +	int 		heads;
> +	int 		sectors;
> +	sector_t	cylinders;
> +	ulong		dummy;

Plain old `unsigned long' is preferred.

> +	/* Default heads (64) & sectors (32) */
> +	heads 		= 64;
> +	sectors 	= 32;
> +
> +	dummy		= heads * sectors;
> +	cylinders	=  capacity;
> +
> +	sector_div(cylinders, dummy);
> +
> +	/*
> +	 * Handle extended translation size for logical drives > 1Gb
> +	 */
> +	
> +	if ((ulong)capacity >= 0x200000) {

Here we're casting a sector_t down to a 32-bit number.  Are you sure that
`capacity' here can never exceed 0xffffffff?

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux