Re: [PATCH 12/15] alim15x3: ->speedproc, filter out invalid modes passed from user-space

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

 



Bartlomiej Zolnierkiewicz wrote:
* ->speedproc, filter out invalid modes passed from user-space.

* Add FIXME about DMA timings never being set.

* Bump driver version.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>

Index: b/drivers/ide/pci/alim15x3.c
===================================================================
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -425,6 +425,17 @@ static int ali15x3_tune_chipset (ide_dri
 	u8 tmpbyte		= 0x00;
 	int m5229_udma		= (hwif->channel) ? 0x57 : 0x56;
+ /*
+	 * Paranoia, filter out invalid modes passed from user-space
+	 * (unsupported UDMA modes are dealt by ide_rate_filter() call).
+	 *
+	 * This will go away once ide_set_xfer() is fixed.
+	 */
+	if ((speed > XFER_PIO_5 && speed < XFER_SW_DMA_0) ||
+	    (speed > XFER_SW_DMA_2 && speed < XFER_MW_DMA_0) ||
+	    (speed > XFER_MW_DMA_2 && speed < XFER_UDMA_0))
+		return -1;
+
 	if (speed == XFER_UDMA_6)
 		speed1 = 0x47;
@@ -437,6 +448,10 @@ static int ali15x3_tune_chipset (ide_dri
 		tmpbyte &= ultra_enable;
 		pci_write_config_byte(dev, m5229_udma, tmpbyte);
+ /*
+		 * FIXME: Oh, my... DMA timings are never set.
+		 */
+

   Erm, wouldn't it have been better to mark them as unsupported while at it?

 		if (speed < XFER_SW_DMA_0)
 			(void) ali15x3_tune_pio(drive, speed - XFER_PIO_0);
 	} else {

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

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux