From patchwork Fri Jun 22 11:15:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10481887 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3A5166023A for ; Fri, 22 Jun 2018 11:16:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26EA028E6D for ; Fri, 22 Jun 2018 11:16:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AF8628EA0; Fri, 22 Jun 2018 11:16:12 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38BF428E6D for ; Fri, 22 Jun 2018 11:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbeFVLQJ (ORCPT ); Fri, 22 Jun 2018 07:16:09 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:49178 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbeFVLQJ (ORCPT ); Fri, 22 Jun 2018 07:16:09 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5MBDsHu130827; Fri, 22 Jun 2018 11:16:06 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-2017-10-26; bh=+kG+9CuKDSKmrq7pCtkFB43+Zlog1OmeSX4ooKtJLjE=; b=UoKNlTomuMymjnjsJKUCMoVlMlj5zFwaMSqmPMM1GwbYubtbpTKsMv+mEC9kqxJgthWo RxHQyoNVrNn2y9NAlKbbbP8d6vIE5Q8pO/uLN1zGicaXcg9oPXgB3kOWkJZh7HMj7wA1 mPLuP4ZuobLqSJ//PeKfrCa5WLLuoVqGsE8UbD6UPcpZK3Por+BegLDR7zxe925LxFFT 3+tv+MnbZCAuiPBpB/MIrmO2Ge1LmiJRTBUTWlrC2Kq2wL9AV8Jqm8AP6KkUK4Osm5Ph pB+iqGVJT+pIkqurKy5ujlC1zF9lbpu5natPPN9/Dyb+4J387nHuhYoxsDAj7vOv+m5W VA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2jrp8esjkv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jun 2018 11:16:06 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5MBG5fd021330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jun 2018 11:16:05 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5MBG4ow022022; Fri, 22 Jun 2018 11:16:04 GMT Received: from kili.mountain (/41.202.241.28) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 22 Jun 2018 04:16:04 -0700 Date: Fri, 22 Jun 2018 14:15:47 +0300 From: Dan Carpenter To: Vinod Koul , Zhangfei Gao Cc: Vinod Koul , dmaengine@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate() Message-ID: <20180622111547.urjjagjf6rxbobpq@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=8931 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=619 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806220128 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The d->chans[] array has d->dma_requests elements so the > should be >= here. Fixes: 8e6152bc660e ("dmaengine: Add hisilicon k3 DMA engine driver") Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe dmaengine" 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/dma/k3dma.c b/drivers/dma/k3dma.c index fa31cccbe04f..6bfa217ed6d0 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -794,7 +794,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec, struct k3_dma_dev *d = ofdma->of_dma_data; unsigned int request = dma_spec->args[0]; - if (request > d->dma_requests) + if (request >= d->dma_requests) return NULL; return dma_get_slave_channel(&(d->chans[request].vc.chan));