From patchwork Sun Sep 17 14:25:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 9954827 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 816F76039A for ; Sun, 17 Sep 2017 14:25:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F37728A98 for ; Sun, 17 Sep 2017 14:25:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6407128A9E; Sun, 17 Sep 2017 14:25:23 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 6E46728A98 for ; Sun, 17 Sep 2017 14:25:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbdIQOZS (ORCPT ); Sun, 17 Sep 2017 10:25:18 -0400 Received: from mail-out-1.itc.rwth-aachen.de ([134.130.5.46]:3614 "EHLO mail-out-1.itc.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298AbdIQOZS (ORCPT ); Sun, 17 Sep 2017 10:25:18 -0400 X-IronPort-AV: E=Sophos;i="5.42,407,1500933600"; d="scan'208";a="13756754" Received: from rwthex-w1-a.rwth-ad.de ([134.130.26.156]) by mail-in-1.itc.rwth-aachen.de with ESMTP; 17 Sep 2017 16:25:16 +0200 Received: from pebbles.fritz.box (77.181.34.79) by rwthex-w1-a.rwth-ad.de (2002:8682:1a9c::8682:1a9c) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Sun, 17 Sep 2017 16:25:16 +0200 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: CC: Vinod Koul , , "Dan Williams" Subject: [PATCH] dmaengine: edma: Reject slave configs using a buswidth of 8 and larger Date: Sun, 17 Sep 2017 16:25:10 +0200 Message-ID: <20170917142510.3111-1-stefan.bruens@rwth-aachen.de> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-Originating-IP: [77.181.34.79] X-ClientProxiedBy: rwthex-s3-a.rwth-ad.de (2002:8682:1aa0::8682:1aa0) To rwthex-w1-a.rwth-ad.de (2002:8682:1a9c::8682:1a9c) Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver would happily accept buswidth of 16/32/64 bytes and program garbage to its registers. Signed-off-by: Stefan BrĂ¼ns Acked-by: Peter Ujfalusi --- drivers/dma/edma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 3879f80a4815..c944ea339425 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -887,8 +887,8 @@ static int edma_slave_config(struct dma_chan *chan, { struct edma_chan *echan = to_edma_chan(chan); - if (cfg->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES || - cfg->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES) + if (cfg->src_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES || + cfg->dst_addr_width >= DMA_SLAVE_BUSWIDTH_8_BYTES) return -EINVAL; memcpy(&echan->cfg, cfg, sizeof(echan->cfg));