From patchwork Mon Mar 11 11:41:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 226536 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 474582C02AF for ; Mon, 11 Mar 2013 22:43:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754107Ab3CKLn0 (ORCPT ); Mon, 11 Mar 2013 07:43:26 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:38082 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753886Ab3CKLnW (ORCPT ); Mon, 11 Mar 2013 07:43:22 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2BBhIgF028201 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 11 Mar 2013 11:43:19 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2BBhIXT007511 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 Mar 2013 11:43:18 GMT Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2BBhHoJ032599; Mon, 11 Mar 2013 06:43:17 -0500 Received: from longonot.mountain (/41.202.240.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 11 Mar 2013 04:43:16 -0700 Date: Mon, 11 Mar 2013 14:41:51 +0300 From: Dan Carpenter To: Jeff Garzik Cc: linux-ide@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] pata_legacy: bogus clock in opti82c46x_set_piomode() Message-ID: <20130311114151.GB8235@longonot.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org "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 --- I don't have the hardware to test this. -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 4fe9d21..be81642 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c @@ -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);