]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pata_legacy: bogus clock in opti82c46x_set_piomode()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 11 Mar 2013 11:41:51 +0000 (14:41 +0300)
committerJeff Garzik <jgarzik@redhat.com>
Wed, 3 Apr 2013 23:53:10 +0000 (19:53 -0400)
"sysclk" is used as an index into a 4 element array.  My static
checker complains because it can be out of bounds.  From the
context, it looks like there is a right bit shift missing.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/pata_legacy.c

index 4fe9d2138d48f58f5d094b88ffea6c35416cc935..be816428b430fbb73135ef1591bbde2219097221 100644 (file)
@@ -542,7 +542,7 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev)
        u8 sysclk;
 
        /* Get the clock */
-       sysclk = opti_syscfg(0xAC) & 0xC0;      /* BIOS set */
+       sysclk = (opti_syscfg(0xAC) & 0xC0) >> 6;       /* BIOS set */
 
        /* Enter configuration mode */
        ioread16(ap->ioaddr.error_addr);