From patchwork Tue Sep 14 08:28:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 12492313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D19CC433F5 for ; Tue, 14 Sep 2021 08:31:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 661DE60F24 for ; Tue, 14 Sep 2021 08:31:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 661DE60F24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wHoVlJpFcEx0OowwKDlm6yMRrPteBsxPjWMlBv+9dX0=; b=EfpwnxIuz/ugIG jSdR4ZIGL6B7M++oqpyeLMkB52kvsbbNykneWiovwvxWidu+ZjXxZnvHi4kno9CCM6JOHA7MqXI7E cJK3J4ujd9HIulphxeAKRaF/T1rZurhguY2/61MnDSZD5CHtqZRaXOf7HRDcuRM1awPGeSlQhfRFb InvnbCQUI0DnuyynMUtW4d7ikToadz+6Xft339w8qUIEGiQTKK974gLjLq7+TKQYz8r73v4QJvjAj kgpOHqTGpofaSzVb55A4B1pbiDgdMNT/e2VK8qJTuNKrR7jaw+mc2Z1RqUJLeCR6Mr0LNcjIUCwDW KgMS7i5DGkhYJWLVdSWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3o6-004g8g-B0; Tue, 14 Sep 2021 08:28:46 +0000 Received: from mail-dm6nam08on2061.outbound.protection.outlook.com ([40.107.102.61] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3nq-004g4Q-UJ for linux-arm-kernel@lists.infradead.org; Tue, 14 Sep 2021 08:28:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F/hktOTU+EQ0POxr36hwbXRME32w09aEJDvcUMY85kV1REKb8121uhbLqnddv3M1lUPU+LkUPqki2kiGXhEzYwT8E4hP/RDdYi7ttpnsEbp5voNnzNsbarukLBHwjV6MuvTaz5qwAY7vMayySRo6CmK5/QSek1M4wMdoBiH/7CHaWzowIZCVmLOS43gHjGOjdpB5ruUzGENzGzRgevxCcQ05pjghQshpBFKv5LY6S7bZPXOW2GeDYLa/flCQvEDF7UpA5THSvz79zemvwJct5IarDD0jp+h8MsBI3P3RDA6BzM+bIzjlaFVHDgsqhvtAs37hglpMRk0uD7/Q2A94FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rTVl+iqbrrMSgEzQGPiHm66OekzzwfwmiPD4MHxj/Lc=; b=CPH2QEQETuhaFF6CcaccMBN388N1Bbp+hQaTV2CmysTQCtGgE4tAlel+Nm38SLjTrHyIIEenWc3wqgpOXbEXQbFkOwRtyg4uRBoadlF4263+1xMyO2TOs1qf0m1/JoApdTKhg9BXslk2sAWWaXsPSlUvjzV9S8foTNteMvhPBtjjJAuzOlX/O39UJqyH4dKOJe4sUptLKon3BZnXhcTZ8IipkCWIWSYMiBUrI1tfL742qptz4qaHSciMXLUazIHtg1xgqIHlJ5RmsLLaeioaRnpj2LcXsaRh4+uOaBq6haLTs4SLTsp/eYVb4GczGwVqfGKupKSKJYAarNCxPe/heg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rTVl+iqbrrMSgEzQGPiHm66OekzzwfwmiPD4MHxj/Lc=; b=RZ3G6lK2aElMAXfMv3NPNsBadcqGVsmQ3L2WGWJJxCjoMUQR7+rZ0VAvaGnOYxv8V2I9ALcODNXew4Dtru8k1ZTJK/6IvBGfMgTKHskRGHVYSZR9TH9s6M7EWKiR4D+GWEXdk1kho58rTMFcn2hxEx5PutwMypRoIBBRK44aoyY= Received: from SA0PR11CA0110.namprd11.prod.outlook.com (2603:10b6:806:d1::25) by DM5PR02MB2698.namprd02.prod.outlook.com (2603:10b6:3:10e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Tue, 14 Sep 2021 08:28:27 +0000 Received: from SN1NAM02FT0008.eop-nam02.prod.protection.outlook.com (2603:10b6:806:d1:cafe::27) by SA0PR11CA0110.outlook.office365.com (2603:10b6:806:d1::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0008.mail.protection.outlook.com (10.97.5.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:26 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 14 Sep 2021 01:28:24 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 14 Sep 2021 01:28:24 -0700 Received: from [10.140.6.13] (port=35510 helo=xhdharinik40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mQ3nk-00094b-Fs; Tue, 14 Sep 2021 01:28:24 -0700 From: Harini Katakam To: , , , CC: , , , , , , , Subject: [PATCH 1/4] dmaengine: zynqmp_dma: Typecast the variable to handle overflow Date: Tue, 14 Sep 2021 13:58:14 +0530 Message-ID: <20210914082817.22311-2-harini.katakam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210914082817.22311-1-harini.katakam@xilinx.com> References: <20210914082817.22311-1-harini.katakam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b9f8617-cc8d-46fa-ddf2-08d977599fd0 X-MS-TrafficTypeDiagnostic: DM5PR02MB2698: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nLFltj2cplKIQ25Z0t6GuNO7hkhBK99GUsAF0oiSld8F8IgXaZV4osxtiZ4VHhkUfjvjzc4+NEODxGnW0e9cTz/T5mRKvmkWGkLpg+gPPFbJ9S8mriJ0XFWqaWSW8RYjATm8UWezBAcgVXiq0r3cWiAurq51723JeyKT/T+Lha/w5zwibM6AOggviZUzdgICg0XAcNJYcWdbCQhBwsE0TvBXehCbTaM10VEJQ28stMgfEhOq9oFzWXfmJUkW2+dXNKjZEY4esa1obQc19aAjR7QlhyX99282fRG2YpxISnJ9pqEq6guSFW5Owz3Eryal1MLzuj+/FKTD/s64NmuyD9bz3eZ/7dycn1eQ/O921IEaKZxzAzjm65HpGTUUMn8MUSkGQIY4t4fPGUGolBuSNog8mDBWP7yq5Ybb/76+XklOs2hBgSzbGxjvb3TSm7qUqOxzIg1h2ClCp0J5PCTH1Z24e+pvZZjd7orRfoS+MPOd4MTkR0DX3f8zwtZiZyYnOD8dkO634hnECnPsYSZ3Vu7iKmdBhFnq1WWbFjeLOXc/unshw9zb2KwhFsvLPwMVTrQVKoGTCzkvA90dMm+tajfpBIRKjTvtCmZz91BleUwhfY0hMqVlq7g5lnZDZOWLkmrw1uRz28T6XNHona7pZeVKZ/zLitI0B4F+ONBTp4hjcG6+KoNj7BeTXAGA8MU0j3TBtfvWyuy5km1x9LOtoCfXzW5hxrU+qoDwdnjjy5o= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(36840700001)(46966006)(7636003)(26005)(186003)(36906005)(8676002)(356005)(107886003)(82310400003)(110136005)(8936002)(70586007)(316002)(82740400003)(2616005)(36860700001)(44832011)(4326008)(7696005)(47076005)(54906003)(70206006)(36756003)(1076003)(2906002)(9786002)(83380400001)(5660300002)(336012)(426003)(478600001)(6666004)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 08:28:26.5886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b9f8617-cc8d-46fa-ddf2-08d977599fd0 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0008.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2698 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210914_012831_011831_5419CF2A X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Shravya Kumbham In zynqmp_dma_alloc/free_chan_resources functions there is a potential overflow in the below expressions. dma_alloc_coherent(chan->dev, (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS), &chan->desc_pool_p, GFP_KERNEL); dma_free_coherent(chan->dev,(2 * ZYNQMP_DMA_DESC_SIZE(chan) * ZYNQMP_DMA_NUM_DESCS), chan->desc_pool_v, chan->desc_pool_p); The arguments desc_size and ZYNQMP_DMA_NUM_DESCS are 32 bit. Though this overflow condition is not observed but it is a potential problem in the case of 32-bit multiplication. Hence fix it by using typecast. Addresses-Coverity: Event overflow_before_widen. Signed-off-by: Shravya Kumbham Reviewed-by: Radhey Shyam Pandey --- drivers/dma/xilinx/zynqmp_dma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 5fecf5aa6e85..2d0eba25739d 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -490,7 +490,8 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) } chan->desc_pool_v = dma_alloc_coherent(chan->dev, - (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS), + ((size_t)(2 * chan->desc_size) * + ZYNQMP_DMA_NUM_DESCS), &chan->desc_pool_p, GFP_KERNEL); if (!chan->desc_pool_v) return -ENOMEM; @@ -677,7 +678,8 @@ static void zynqmp_dma_free_chan_resources(struct dma_chan *dchan) zynqmp_dma_free_descriptors(chan); spin_unlock_irqrestore(&chan->lock, irqflags); dma_free_coherent(chan->dev, - (2 * ZYNQMP_DMA_DESC_SIZE(chan) * ZYNQMP_DMA_NUM_DESCS), + ((size_t)(2 * ZYNQMP_DMA_DESC_SIZE(chan)) * + ZYNQMP_DMA_NUM_DESCS), chan->desc_pool_v, chan->desc_pool_p); kfree(chan->sw_desc_pool); pm_runtime_mark_last_busy(chan->dev); From patchwork Tue Sep 14 08:28:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 12492315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83F0BC433F5 for ; Tue, 14 Sep 2021 08:32:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FB8060F23 for ; Tue, 14 Sep 2021 08:32:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4FB8060F23 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qz273bSHNQWQ6TQ1Vsmzf0HubJXeYQ1h1fYEZbIDZvo=; b=Hcrz+35L0aIgT4 0ZfhNjUunyF/GqIlKL6jFHl5nfQMEngMBF3JGrZvI9Z26q0c17cD8c7YntETuVUBQjEeZqZgmXcF+ tFA72aGFJQPmTpsW52QGo3iC8r57zxug/SOW6GdNrT8Xl9lwM3eTJ8RshKQR28e0CCD8ZcNOdl78S 1w5EjqW0IU+z5Duy+6k4CrgW/EfKIgabTSy9h7+H0Doo3ivY0bqSie0MVH/N+/BId0OVTaAoVtDoZ ar1J5G7okPNWrJxNQYMlYmsQclsO33noexb0Zw35hn6iYPpiBzoHvoesjwZm1W5h3HGBw23uPvL/w UVoTJa6wfPbn9PamNErQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3oL-004gCf-PB; Tue, 14 Sep 2021 08:29:02 +0000 Received: from mail-bn7nam10on2084.outbound.protection.outlook.com ([40.107.92.84] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3ns-004g4u-GD for linux-arm-kernel@lists.infradead.org; Tue, 14 Sep 2021 08:28:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cnbe4itU6FvQ4npjY9esSfF7u+sfp1rFrAYgumSYEXU/AnvtHlth9zGR4zq6cz0JLnKJS1r4XAVcA2pf2K4dqpsmrXj27O2IRO73SflrguviqVVp4x7MpMk4U90GHxBXYa0L4IN+86bKoCDndQ+PRRYkYpcoFjdM89hFJSSzQt9UNJCgxAFP0qm0yMK52jwOuklJt5gEDZcikwtaZgYLqzF5PcoxZ5Mfuv3mT1dJk5aYO0bTdlfp2CC7t3ipePZSn17/8ZQyd4xkVdW5hEVVmjlGEwso6YYBvsKfCggrcFAmKVoajSgVRR+nf+vwuNnrfEPTq5H9V7GnoGUyUDbNAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=aCTGRg/I5ahensrOBg0zP3XYp5MeFE2Nvf/XlLN/z98=; b=n3GohO9Az1x9IIFRwlWADHcGYFXEM0+ESMdzQArC64SdKMJmMOQsC944S3JmchzkWOTBd6nznYa9II/FggB7iCM9srU5TaFf0bM0AnNExyzLgd8uFSMxHkleD6hvVnistSada6NpPe0K17UOxAOBevXF93u8lq8J/i08YcbFmu5flyn6ty9sc6f4Jjv1q1OCr2JMp4DQpauypLUj9iMqPTIapQkEV+7e6dB2WjX/nHjqXjhxmgssLrT63hIoHS5z8VgEEcGdB4z09s6FgLY304SInlAXTEoyGJA2Vy5FmcRBNU9/lko6AmA/+lCTCG6rB2qvVy7DDnHfLI3sg4ftTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aCTGRg/I5ahensrOBg0zP3XYp5MeFE2Nvf/XlLN/z98=; b=YRAjzkPv2sGxkn6P509xD7wDuwPfOZwCTLkAjRzyRqEYS3Tt+1eyG93L0HOPuGr0XztrXm8t0Td4pWzov7hO5OON6sSBLcX1X9FUua+NpxTKRu0ZAm25oyuuVYYbAbTzeoE2Sz4nJNPcKpv0DyEsxKZE6/XdwtgqhHMhMSw3T9c= Received: from SN1PR12CA0111.namprd12.prod.outlook.com (2603:10b6:802:21::46) by DM5PR02MB2746.namprd02.prod.outlook.com (2603:10b6:3:10c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Tue, 14 Sep 2021 08:28:29 +0000 Received: from SN1NAM02FT0030.eop-nam02.prod.protection.outlook.com (2603:10b6:802:21:cafe::31) by SN1PR12CA0111.outlook.office365.com (2603:10b6:802:21::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0030.mail.protection.outlook.com (10.97.5.194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:28 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 14 Sep 2021 01:28:28 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 14 Sep 2021 01:28:28 -0700 Received: from [10.140.6.13] (port=35510 helo=xhdharinik40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mQ3nn-00094b-S1; Tue, 14 Sep 2021 01:28:28 -0700 From: Harini Katakam To: , , , CC: , , , , , , , Subject: [PATCH 2/4] dmaengine: zynqmp_dma: Typecast the variable with dma_addr_t to handle overflow Date: Tue, 14 Sep 2021 13:58:15 +0530 Message-ID: <20210914082817.22311-3-harini.katakam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210914082817.22311-1-harini.katakam@xilinx.com> References: <20210914082817.22311-1-harini.katakam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4bff6dd-e1ef-44d3-b855-08d97759a12b X-MS-TrafficTypeDiagnostic: DM5PR02MB2746: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eqWPNGAgRyAj+CvWjYIvd4CWJDqjocf2iw1ZGo//VLYsBpgjI/dynUD073AM5DTZKUfnkrcfiohcLy/waWUcYgnArmyzII/ZClzyRURLrodwhjQOFVhXfI5OA29smBYKRJ2ZVaGfHmg6NeLB4ks0cjfVy5aBLquFSRHlAjFIyMIbXjh/DNf79tbLaWGmEB6coJXO0Ux8t/K9VlgGeKdAoEvHCEyY5dEak5+HBQCzKyyPh3KmCCxPyQ7OIsOvSe+EUPGQk87lkVcKp9umYorHyNAi/j7vFRlKrdo6kAmm3rKpzaonj97qcA+3RdFvWAZf017J7YfNp2gJHr7ByY8iC0Sd0mRc4cGLZUYCkqTWn115kX+4thgWvz0VdP15T2Rfb1Nmqmjk+mHT/l4ubxVkmagP24MfFhLYfIZhMKj8vFaT0SDQ2zoOZzmWYHwtZHpDqVKQYJU0r5AIzCWzqy1CEU5qsG5menyZQACm4CYlXT7h8uWg9eBHF3RaR9NHjcJ/Yu1w8CVd9wlhyqJnRTrmvqCCB9cLLj2y6T+5TStxRkHuMFgAx+Cma9Z9/q3gMRxCoIzh4LCaW+BYF+oe0bJCYKyofbxYgen1QbWIAJIpNDxZ+JK5jvdGtWLg9iyWwKAt1x/fuHfBYlOVugHMuJuPrZ4BICnMIyfps9ScaY363Kj6CjAbLQutqRVPGT+pJSmQlvK3Nn5YPlxoKy7/KruYWfXRt1329WoHrQPd7jgs16U= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(376002)(396003)(39860400002)(136003)(46966006)(36840700001)(478600001)(8936002)(186003)(2616005)(26005)(83380400001)(336012)(44832011)(8676002)(7696005)(82310400003)(5660300002)(36906005)(9786002)(426003)(110136005)(54906003)(356005)(47076005)(36756003)(1076003)(107886003)(2906002)(4326008)(7636003)(82740400003)(70206006)(70586007)(6666004)(36860700001)(316002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 08:28:28.8627 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4bff6dd-e1ef-44d3-b855-08d97759a12b X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0030.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2746 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210914_012832_612759_1C0D91A3 X-CRM114-Status: GOOD ( 10.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Shravya Kumbham In zynqmp_dma_alloc_chan_resources function there is a potential overflow in the below expression. desc->src_p = chan->desc_pool_p + (i * ZYNQMP_DMA_DESC_SIZE(chan*2); The macro ZYNQMP_DMA_DESC_SIZE and variable i are 32-bit. Though this overflow condition is not observed but it is a potential problem in the case of 32-bit multiplication. Hence fix it by using typecast. Addresses-Coverity: Event overflow_before_widen. Signed-off-by: Shravya Kumbham Reviewed-by: Radhey Shyam Pandey --- drivers/dma/xilinx/zynqmp_dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 2d0eba25739d..d28b9ffb4309 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -502,7 +502,8 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) (i * ZYNQMP_DMA_DESC_SIZE(chan) * 2)); desc->dst_v = (struct zynqmp_dma_desc_ll *) (desc->src_v + 1); desc->src_p = chan->desc_pool_p + - (i * ZYNQMP_DMA_DESC_SIZE(chan) * 2); + ((dma_addr_t)i * ZYNQMP_DMA_DESC_SIZE(chan) + * 2); desc->dst_p = desc->src_p + ZYNQMP_DMA_DESC_SIZE(chan); } From patchwork Tue Sep 14 08:28:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 12492321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C000C433F5 for ; Tue, 14 Sep 2021 08:33:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F23E60F23 for ; Tue, 14 Sep 2021 08:33:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F23E60F23 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3wiFnQwc0a7tqJERnh9SfJuU98ejO0x08cwPm30A9QA=; b=nIj50HQzD7x037 uXt9t+L7GPLSwPWD++iChiogLaIk/NVZUwc4uT/Laufun3eH/bqe4wJYW6O4LkZ0EauDt2kQh5Mre Rurjc/q3OE13H4C0paajwMXTIBBBFTU46TpEh0ZIaKLl8CddL8ykqIOYLdC7lmvgJUi1b1Ndbg+Xa KhMotT/M1OyYJrsxo1Vk5/fVFPrAjxiDEejoZIqOBUovTVUT572wUQ7UZfeJf1bIpMjWupCWRGz5Q xXcZZ3wQN4aWSi/Bi9k91mHx85raaPz7rGPGSqVxHjD7Jzu1x9gcJdoWCSsSFtUl3YDl32uRpEsUs r75Q5rOEtvN522rz2GXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3oh-004gIz-9t; Tue, 14 Sep 2021 08:29:24 +0000 Received: from mail-dm3nam07on2047.outbound.protection.outlook.com ([40.107.95.47] helo=NAM02-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3nw-004g6U-NC for linux-arm-kernel@lists.infradead.org; Tue, 14 Sep 2021 08:28:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k3SZR/EQCaPEAFdBY5nPEcMUP9hUFg4jVCkiuFqXngnJkV2ILljms1wDrcTfDE2Oqo2zLcVb4wmMdqrb2iTfkMhCR4AzN9xoHhEbpFq8GAyKdlCUAIO0e+wyqxLGYlnIf5wADvFc936O3xG9ovluN4DEoiC28lcLY9q5//+iUKiva0rd50YMMjgZT61oNzUvMQGBIgl8nNHb7yROjx9ix2Vk30caYhxC2saRqrXvTFlt9WTT8ew0mbnejQCTj2CQFPNov3jae5OCiQozLybgbRYGZe1VcYK0BZ6+7bU5OFXvuehMR0cjQUxUhmiCQICFA4/VbILYnr0Mtcons03iZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4dbZLk3Ho/PvecpjEqfBcT4ytFxuimA9E8AVIQgheHE=; b=FPB4lgGTBVc6AoH8wyb3iCa5cw+SRo69bXLSu4+GfsqTQQsrsyQfVqvpJuXCLWg8Kl1W/uNzLU2cKX2prWXKTOk4zR2OXLvBMcq7Uw1q2m8St18ZjHJ2/3TjS/SV00orw79rxExscztzyZKPiZqK2bCo0He2g+a0eG9ahlQyPkHNXOpPzCSudCAtHwRlmplSeJ2B/i38uVjlhBpdBmEvPLDZ2NVFJ3PMGRQkqbNy30f+NbXBkhGz0qf4islixtyt68pr/RVCXh5/heF2Trd7cf1Zwk234VQ+Ud5zzJbnssHZOZJgnlLLCAVi1SZlQT5w3y8Xmv62ea6bjgus+Ac1AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4dbZLk3Ho/PvecpjEqfBcT4ytFxuimA9E8AVIQgheHE=; b=Oyo42GMiUKL2jD0smo54va8NHpTPxDsq/uIizrk583sr4VmXm+1FXD+XzJ3WCe+lRmg8LsIUF02ILWuCoshV70tPKgnNw5N8F35qWbpLZ2myD6E5ZUksyhexdxDe8soz3Mr6u/Zu2R8Pnmzpou1x1LtZEww2h9sNRvg+tk0P7qE= Received: from SN2PR01CA0039.prod.exchangelabs.com (2603:10b6:804:2::49) by MWHPR0201MB3561.namprd02.prod.outlook.com (2603:10b6:301:79::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Tue, 14 Sep 2021 08:28:33 +0000 Received: from SN1NAM02FT0059.eop-nam02.prod.protection.outlook.com (2603:10b6:804:2:cafe::f9) by SN2PR01CA0039.outlook.office365.com (2603:10b6:804:2::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16 via Frontend Transport; Tue, 14 Sep 2021 08:28:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0059.mail.protection.outlook.com (10.97.5.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:33 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 14 Sep 2021 01:28:31 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 14 Sep 2021 01:28:31 -0700 Received: from [10.140.6.13] (port=35510 helo=xhdharinik40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mQ3nr-00094b-86; Tue, 14 Sep 2021 01:28:31 -0700 From: Harini Katakam To: , , , CC: , , , , , , , Subject: [PATCH 3/4] dmaengine: zynqmp_dma: Add conditions for return value check Date: Tue, 14 Sep 2021 13:58:16 +0530 Message-ID: <20210914082817.22311-4-harini.katakam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210914082817.22311-1-harini.katakam@xilinx.com> References: <20210914082817.22311-1-harini.katakam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf5d2acf-b1d5-4eb5-c095-08d97759a3a7 X-MS-TrafficTypeDiagnostic: MWHPR0201MB3561: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZvwD+b31qnUDcJITFI/qh/Cxzk0RxUsnaH3ML7FsVQCRMVLC7o/UwdHWG+5FAM0DmenCYx2RsP6H7ETc6scUWEKg9xb+zDS5A0Nts9VU/MTd3x7g7JafwhG6cvyY37WgcvqXFJ73jBFLWIbGj5jxUwx4q1WboSr4XjB0GF/gVkIHxPUZrBImRJZPAVBJ+/0+P0AffOMiQE9PcuQXDclEOKpYZcEFa9kSb58GA/fvTcBIHytFmh4e2haUnyYJBsrlYEQlQXg/XnbqXDkTP331Cn6NHR+8EMRlG0+JY4xYmf+Le+nNGqU49xMOL4DDQtHiDsS+75o2kCD/4ezZNBeKnBFkk8rbUf9g2rSV0DAkTnupPg5UU3uhImG7964ksX+Me99qFxBHUF4Z0Rcl6EHYJXJchVrtrLv1J9TzVThSkd+8WkbOj5sCLUizpHcTHDfrblnSVj1TnOD9mJyF4PEtbNSG9eoE6CqdFFrMm5JDZUqMdynR8DPLz6x6R0RJ/q08sIWvWb2i8v7Ne6dY0Z2fWXxWbY58L/5LUH23crx9GTOWxOv62mJK6TYNK6mi0FgfDoEfCGlCeN5htuLxIEWRnYvSSvRf6DYWz4b1DO2mF1l9WTgRPZSKufUYnMB7dFrWymqwLng4+4K36wQOBNBromE+SpA9MvvUcQjKTSVLXwris5Xhhuo0jB2vcArTXfvnHEHPHT7LVmxmtdii/4FUcGXc8x9rOJUk73cc1DLGCZY= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(136003)(396003)(39860400002)(346002)(46966006)(36840700001)(7636003)(478600001)(26005)(82310400003)(36756003)(1076003)(186003)(82740400003)(8936002)(8676002)(356005)(9786002)(107886003)(2906002)(4326008)(36860700001)(44832011)(5660300002)(426003)(6666004)(83380400001)(70586007)(7696005)(54906003)(70206006)(336012)(2616005)(316002)(47076005)(110136005)(36906005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 08:28:33.0310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf5d2acf-b1d5-4eb5-c095-08d97759a3a7 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0059.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0201MB3561 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210914_012836_811659_57BFCD19 X-CRM114-Status: GOOD ( 12.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Shravya Kumbham Add condition to check the return value of dma_async_device_register and pm_runtime_get_sync functions. Addresses-Coverity: Event check_return. Signed-off-by: Shravya Kumbham Reviewed-by: Radhey Shyam Pandey --- drivers/dma/xilinx/zynqmp_dma.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index d28b9ffb4309..588460e56ab8 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -1080,7 +1080,11 @@ static int zynqmp_dma_probe(struct platform_device *pdev) pm_runtime_set_autosuspend_delay(zdev->dev, ZDMA_PM_TIMEOUT); pm_runtime_use_autosuspend(zdev->dev); pm_runtime_enable(zdev->dev); - pm_runtime_get_sync(zdev->dev); + ret = pm_runtime_get_sync(zdev->dev); + if (ret < 0) { + dev_err(zdev->dev, "pm_runtime_get_sync() failed\n"); + pm_runtime_disable(zdev->dev); + } if (!pm_runtime_enabled(zdev->dev)) { ret = zynqmp_dma_runtime_resume(zdev->dev); if (ret) @@ -1096,7 +1100,11 @@ static int zynqmp_dma_probe(struct platform_device *pdev) p->dst_addr_widths = BIT(zdev->chan->bus_width / 8); p->src_addr_widths = BIT(zdev->chan->bus_width / 8); - dma_async_device_register(&zdev->common); + ret = dma_async_device_register(&zdev->common); + if (ret) { + dev_err(zdev->dev, "failed to register the dma device\n"); + goto free_chan_resources; + } ret = of_dma_controller_register(pdev->dev.of_node, of_zynqmp_dma_xlate, zdev); From patchwork Tue Sep 14 08:28:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 12492317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7219BC433F5 for ; Tue, 14 Sep 2021 08:32:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 433656103B for ; Tue, 14 Sep 2021 08:32:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 433656103B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zGOaVVFegeqMJT0ENnt44zfWIz3PV4SRMGKoY/Dfy1g=; b=OP4z43Q23h2ppc v3WF81tZk8tZj73fUUjofafFLaNsRQR0yg6VnGM5e1tWa/0EOzV71I+tfsBIv6rbUow0Ftedkq3Nv LAPy1P/7wnvk2KUXHgonBGjB5Gsyp3loiclkXjzSiepyxBTgHFzjWnu7PglgsTFT5AUn4aoiBFZR9 AuKvX+HtL/fyaKKbzDwIHBI3wN0aaymnlwU2wxp4PrQ/1Y/gOwrD5SekAipPcPcGlQOsBYKc0iqSD K+dz/WpTlaw8xTdL0e3SrFp1EGUbdXweHxbKlvySzU9txFmjsC7L6yQ0vUlofD0eoAQQoTWlXd0xI l+R4PRtNbIglrMeq8y6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3p6-004gS9-P0; Tue, 14 Sep 2021 08:29:49 +0000 Received: from mail-dm6nam10on2072.outbound.protection.outlook.com ([40.107.93.72] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQ3o0-004g7Y-Qh for linux-arm-kernel@lists.infradead.org; Tue, 14 Sep 2021 08:28:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mw3jCMBVusTb+TTBbgg4IFXzPs0yokTvi4Td39P5xy96vgx6OGoDZLQ7J+Xf8Bglc+DDNfK2dWdkD1PNCailKC/SB+4GIzUnof8a7YM8I1Ik6TlqI4g34O+Nz9wYSTx4cVKmoUvfQPNqD+e9hgCaf22r0+9rZC/sLSV3/ijqSZwQVhoktECbFVfbcIYiJSWw5dm80kkGGjOek04q9L5PANd71EUe+pb5yobrgFufXznFEwqI8Y6bywKUpXU+CJW8F/Y/e5+YfPaRzngcJbNIr3iWwewpBUFubTsrFPj0DeO0SfJagIdOTnYS2XZ9e8U7tREk5wcH6cVL122aZPViNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/kHxIV5qDHUCBkwAmGnw7yV6WijHa8TNqOV/eE/WFtg=; b=GTE31CnEd0BwKFLuX8pOKPypyl57zj1iu9LnRcPh/DBbI5ah1kNoScvOJNuR2R4ZIXyH/J3dmjDDcxplZq97RCqaNSArgkqgwJZZ2GgzDoxYcG1I3tGrsqOhhS9kPt55xQRlUUgzvJrE+w+LWqtjiCXUZ1ZT4/ZszqaVymoACZ4LNJe3mbyrDqRxR+RLB+kqkFA2RyNNP/oUtlPdDvOPYgxdm26kgOfHkXJK0XvY29WraFv6Dwoghb3y6A0UDnwOOnBIs4zZsDZqmALpPncAK4k9/8eo8VxM7Dmr6ixJWSeoUoqIwrUr+02U4oIbauWmuESfAHnep9NpWJ3vtaGKEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/kHxIV5qDHUCBkwAmGnw7yV6WijHa8TNqOV/eE/WFtg=; b=KWeqeTZlTU6vxTW3bZ+0cZmA0nfPsEHVu8shtrTPQvtgv+LVA9XYr2YmTyjS6QDJ7OPRv8R4TMOmE4jN4N0pMVUf77cR3Wovo1/gZHSzUvNzHLFLp8L7Qvru36J+hdPCQvT0+dPRe8wdeso9sMGMWraVxEeWwRcuTwdkjZhV3as= Received: from SN7PR04CA0021.namprd04.prod.outlook.com (2603:10b6:806:f2::26) by DM5PR02MB3800.namprd02.prod.outlook.com (2603:10b6:4:bb::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Tue, 14 Sep 2021 08:28:38 +0000 Received: from SN1NAM02FT0050.eop-nam02.prod.protection.outlook.com (2603:10b6:806:f2:cafe::a8) by SN7PR04CA0021.outlook.office365.com (2603:10b6:806:f2::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0050.mail.protection.outlook.com (10.97.5.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4500.14 via Frontend Transport; Tue, 14 Sep 2021 08:28:38 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 14 Sep 2021 01:28:35 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 14 Sep 2021 01:28:35 -0700 Received: from [10.140.6.13] (port=35510 helo=xhdharinik40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mQ3nu-00094b-KP; Tue, 14 Sep 2021 01:28:35 -0700 From: Harini Katakam To: , , , CC: , , , , , , , Subject: [PATCH 4/4] dmaengine: zynqmp_dma: Typecast with enum to fix the coverity warning Date: Tue, 14 Sep 2021 13:58:17 +0530 Message-ID: <20210914082817.22311-5-harini.katakam@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210914082817.22311-1-harini.katakam@xilinx.com> References: <20210914082817.22311-1-harini.katakam@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d406210f-afc2-4b90-ad5f-08d97759a6bc X-MS-TrafficTypeDiagnostic: DM5PR02MB3800: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7kCwc5dPA3FV4LoQka3m3EBeNM0EfQFehm9MwfnJZQ5tZmvdzUyba22V5HToWRmf+KStHvEbSD5KZPiOSrZxTkvfwyTThRBj9veMsAOIk8w90/Ngb66UlK4w0phE1wrmTay8Yp/LN2ie1CAbkEmGjH499baFDJmsyA5ZPxvBk9sXUXa9pPCNqShziyEWivx3EBetYWKKp4TOzJ66QLL7707rE3e7U+IeSo5yGuJVAjWcoz9/W37psdstlQkMocRLhTQwgLnuT6w5P+wsf8mVVCvEyzfFMW6fjeWclZIokFyqA9GYgBHs4KNbXCmjQPY0ExfzRcvo/gmec8dZqDx/jNZ+Eil9Xkd7S/hHMRncEgA6gf9kK3eBbY3Ubx8KGaJPfrN+/lp52SdXQmsjDcVjDkhtF0cptKqCDCGN+3Dzv3qyG3aFhw/HupN5SWROZn4f7fxMCxZW2NAiEdJRLFnS5RWinfOTNuVI+4oZbrg7ia5GpOsQ6g36Wq78ZdJqnC4JXqfGkk6ivUUOL0n8Izl1jlm0VFytijtlgZ+cMwIqmS+I87Yabzgzp9FfyCbDpiXJ0WLenV4AxNa3nQWHQvlRdTYpnantc/G1XkRCYjt3Kxpf7j9CCZRHeFLgWdmDLdT0VMSnk9s0lIQroIKFZgu394Haw6XIzRqfs0aOe30wg4lcpwgxWS12/mpjxw1iAplyw8GZybPHRlJlnM6/OZJ8Z77xlMwMm45Ergqdci+l7A4= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(1076003)(36860700001)(356005)(2906002)(426003)(6666004)(7636003)(4326008)(36756003)(336012)(508600001)(82310400003)(8676002)(83380400001)(7696005)(47076005)(186003)(4744005)(36906005)(70586007)(107886003)(316002)(8936002)(5660300002)(26005)(110136005)(54906003)(9786002)(70206006)(44832011)(2616005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2021 08:28:38.2013 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d406210f-afc2-4b90-ad5f-08d97759a6bc X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0050.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3800 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210914_012840_925871_2B7CD98F X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Shravya Kumbham Typecast the flags variable with (enum dma_ctrl_flags) in zynqmp_dma_prep_memcpy function to fix the coverity warning. Addresses-Coverity: Event mixed_enum_type. Signed-off-by: Shravya Kumbham Reviewed-by: Radhey Shyam Pandey --- drivers/dma/xilinx/zynqmp_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 588460e56ab8..282d01ab402f 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy( zynqmp_dma_desc_config_eod(chan, desc); async_tx_ack(&first->async_tx); - first->async_tx.flags = flags; + first->async_tx.flags = (enum dma_ctrl_flags)flags; return &first->async_tx; }