From patchwork Mon Dec 3 14:52:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10709715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 311C01057 for ; Mon, 3 Dec 2018 14:53:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D1502AF87 for ; Mon, 3 Dec 2018 14:53:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DEDF2B099; Mon, 3 Dec 2018 14:53:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B1B2B2AF87 for ; Mon, 3 Dec 2018 14:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kZsvtugenR2y7Tp9hTh2/lI4/u1Ju0sF5qxmC1STfN4=; b=Rt9CK54I4TwHVe wtWlFpO4DwhH3FgqAj4gB/R8jju2PSZrv+bNJ5L0GHgo6+RC6Us+1il9avWVV8StBt67mwui1XVqr KR2/z7cHOkVI9j7AXCRYfBE11Y5j4Aytqob6+MJ9iovMmvJOhhfxiPnOS+UClrPqMBGH0ZoYqRKM5 B9tUOpb70F4BGuH8TRXOLoTwfatJTiX67UrOpGvN0WHwCAdyNvAy0mRGOmMAa85GWD1Ieh1+9x8V/ OvNSaoz5UyEqEqoorllSulJNg5Re5a5VWlbRpZONlNj7ViFLSQf5+IbjPLhUJAMBhvNqFGzdO7AZl mrZHA13/Hi6Ou3iFKHXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpak-00039X-CB; Mon, 03 Dec 2018 14:52:58 +0000 Received: from aserp2120.oracle.com ([141.146.126.78]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gTpag-00038w-WA for linux-arm-kernel@lists.infradead.org; Mon, 03 Dec 2018 14:52:56 +0000 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB3Emrlb009898; Mon, 3 Dec 2018 14:52:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=3zHu2TS7q888PMagnnYuV5kIkL42s5TP4A1hxO+3J28=; b=SwYI1/AT87hS7QtyHQZMZHpby5X78CIyWeaIHjzX2VJ0w05VyM+9/xNq+VHqTsdFrGhe YGYsc5HxD3Cu5tRJtC5ipEmnviq/gSwkCcEOr40/JXaeHkPr8SZg6M/DyRrXIsvZg793 vPwRtFVaV1/Oti2RlL96/5mY9RPZdiD7iPjPNLpHofkR49bgoYyWPu5n9LsWf9onzXza jNhoQgLwXsTTVtFolDRe6AZnDLI3xpbK/iLQh2Oe+sE00DWyRpoWWd5oZoCsGqq7KH7j 88mAZwlHg2HxrXv4TrBBJ2l6Fj9oGLHoexKfZ0L/YCuxp5BT7m65UUK6PTrUQZXqUq9i 6w== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2p3j8q6t92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 03 Dec 2018 14:52:38 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wB3EqWTc023471 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Dec 2018 14:52:32 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wB3EqVSW027249; Mon, 3 Dec 2018 14:52:32 GMT Received: from kili.mountain (/197.157.0.63) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 03 Dec 2018 06:52:31 -0800 Date: Mon, 3 Dec 2018 17:52:19 +0300 From: Dan Carpenter To: Arnd Bergmann , Pawel Moll Subject: [PATCH] misc: vexpress: Off by one in vexpress_syscfg_exec() Message-ID: <20181203145219.brmtuv26dj3vnc5y@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9096 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812030140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181203_065255_127359_9B7B6863 X-CRM114-Status: GOOD ( 18.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, Lorenzo Pieralisi , Greg Kroah-Hartman , Liviu Dudau , linux-kernel@vger.kernel.org, Sudeep Holla , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The > comparison should be >= to prevent reading beyond the end of the func->template[] array. (The func->template array is allocated in vexpress_syscfg_regmap_init() and it has func->num_templates elements.) Fixes: 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells") Signed-off-by: Dan Carpenter Acked-by: Sudeep Holla --- drivers/misc/vexpress-syscfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c index 6c3591cdf855..a3c6c773d9dc 100644 --- a/drivers/misc/vexpress-syscfg.c +++ b/drivers/misc/vexpress-syscfg.c @@ -61,7 +61,7 @@ static int vexpress_syscfg_exec(struct vexpress_syscfg_func *func, int tries; long timeout; - if (WARN_ON(index > func->num_templates)) + if (WARN_ON(index >= func->num_templates)) return -EINVAL; command = readl(syscfg->base + SYS_CFGCTRL);