From patchwork Wed Dec 13 14:44:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donald Robson X-Patchwork-Id: 13491109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56238C4332F for ; Wed, 13 Dec 2023 14:45:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9715B10E7C1; Wed, 13 Dec 2023 14:45:45 +0000 (UTC) Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 831E610E7C1 for ; Wed, 13 Dec 2023 14:45:43 +0000 (UTC) Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BDDU2F1028726; Wed, 13 Dec 2023 14:45:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h= from:to:cc:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=dk201812; bh=xe+Q2qT/LElBZ3QiCEJzN WVEjwfWZNyL75k1pWTxnOU=; b=jR6Rs9mc3SRbI24QxSCxeYv1KJGzkPdWQ7PdL 9L0iOswrzHlW6B8ZClZyhbQ1NYi+Hfav4gcEsi7e5d96oNlI0D0Lkg2ZdTEb0URp 0Fre+kmP/k/YuTcKbZUmDxiTeF8s3nLDWhAN/VWTtvwuWwLXX7ojARA/Z7jIcB02 vAbM8ExySM0gDtDYfJH8hi4TjamBURyAamAjRnsBtjPfRqbZ1KhGAQrPXrVds3F3 iz0dokGdlO0fm0sap/YN3fmoSHaA/K7k6OQsthzE+QkZHLzk71qMttt87wx//eam rkcP0iUNWmieBdDv5+XhEw1Kqp+vGejy/JID3qF163jz/6NsA== Received: from hhmail04.hh.imgtec.org ([217.156.249.195]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 3uvfcsan3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 13 Dec 2023 14:45:00 +0000 (GMT) Received: from HHMAIL05.hh.imgtec.org (10.100.10.120) by HHMAIL04.hh.imgtec.org (10.100.10.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 13 Dec 2023 14:44:59 +0000 Received: from GBR01-LO4-obe.outbound.protection.outlook.com (104.47.85.105) by email.imgtec.com (10.100.10.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 13 Dec 2023 14:44:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HiZIlQxWhM55NObmLmXvdwt7LNphr1Zy+pwE+uCQISJnmxbqfERDZM0zMKcuGhYL2U1HxJ1r+60DeHg5FfX7Udti79NZUFzEkJkamuugbEdhB8b9vcigEiMW+zjcfAUDZQHNgDsEFjFv43Baq5taa6r08i3wBKpjtI1TGvgK+Bn8M9fC9d6Q3QHOaExFRzeTYhauR0Clltj21/cEf28B0mpgEKd7OsGzhdg3tCKKQwYDHR2sp0AB9RnndIdF0jdhs5gf/Nna2peYOuHrroMhnNkO/F1EYT2J8tBEB6sJJhy5afi/aT2u6UfuchRqMlGRxPsp+au/xqtjzLXLhlDhfw== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xe+Q2qT/LElBZ3QiCEJzNWVEjwfWZNyL75k1pWTxnOU=; b=bBxuLhOQZH0Iv9Jryqn3Nb5oCxN6xuWlUcn/eiJTZDF8YSuWBnr1X48nXAoqTryigBI0SYgD5yn4tw52eEnW7swguWVtws5oURpyJHvYNHqACw7N5/Er7u5nziczTeCZRGiWTr6AJnPV8wha/y4rK561tFRZKBBKS+/M+XkG50bI8OSKXqSI89HdDDl0QBowlfoTW1z/KEU+cmfwAl5oXzRxBjhkNY8l9hJT7+KmXSqyfS155URxALeqEkY8SELL9zQsfU78Z6ArdkrAs1ecPmGtv+17k8ikBBCs+zW3WqmJYUFYK6Cff0YcjCDVwX26yptZ7eMOgR8mscwI7rIikg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=imgtec.com; dmarc=pass action=none header.from=imgtec.com; dkim=pass header.d=imgtec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=IMGTecCRM.onmicrosoft.com; s=selector2-IMGTecCRM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xe+Q2qT/LElBZ3QiCEJzNWVEjwfWZNyL75k1pWTxnOU=; b=DoovGiJkj0fRwMLy+36HCW6Q2MgG+xzAG1I3fPT/AUTk8I3TZ329Gd0f7+dKQGG2WI2ksrCjigjkzEFfYs9LSvKJgb4Mb3qQokOxnpqvvMSJ/3/2v22YRex8ZDllMZosalbU06EgSrR1i6GhWYzUJF+1WdWZQDftS3HbdhJKyOo= Received: from LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:23c::11) by LO0P265MB6535.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2d0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 14:44:57 +0000 Received: from LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM ([fe80::a3f5:aa1a:ff75:79a2]) by LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM ([fe80::a3f5:aa1a:ff75:79a2%4]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 14:44:57 +0000 From: Donald Robson To: , Subject: [PATCH 1/2] drm/imagination: Fix ERR_PTR test on pointer to pointer. Date: Wed, 13 Dec 2023 14:44:30 +0000 Message-Id: <20231213144431.94956-1-donald.robson@imgtec.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: LO4P123CA0332.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::13) To LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:23c::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2P265MB4600:EE_|LO0P265MB6535:EE_ X-MS-Office365-Filtering-Correlation-Id: 14bec3e5-e4f5-4fe5-f009-08dbfbea13b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zKihb9obl/cBYooLge5mcK0urWDFlp7OeQptzXpWwrVd5WTqHurT4xkG8v2Ex2SzgpI5EKaOKnKKdrv9AVUSWdsdrCvq0PgpVgBmd2qH7UYbmGRA7DxGWwI7cmBHC70DMdEedrfGcerffUf6+ONv21WEuAz6Ba7jDsWsNcPG8pEZTmoQL8MloWVl9kHWtXL8wV7JARmgcZTRkgCy4fz5zOMXK1QhODaLe3QdiWjh+HMcCJXo0bB7LIQBSKtdVIVqkEej4JNUpTkOydOyaHUSiTRfPjgCjR4qd79qSyepd1A7t8piR3ng3kXGyPYIaceJVoy9BeAN1VO1ZpU0uaXbKQB7JuGYFopfEok87bwOWi/eOyodVlxb9j7stutLa0QsBKUhVY8O04BV2pywj9ROLU3xpIDLDJME69hihxMlNvr5vG5KQhruFOdRJbKy9PctROpNZbRQ9P3Cx7V+nVruNudW3aDiEkZKzJa52SKnTpVxdHhVeB2LD44DLZ03+xWCbDQcAJL39ZpsB2mgrrSWNye+owkR6KO6rkoY9gS/eVxKjmgDPX/18FwqxWRSSKWvW68rRGVLPuyeEGin2BOq2JwaD15RUt3VfR0k5NdzcYQ8UWVMNdao1eq7zlicA7f4 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39850400004)(396003)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(2616005)(6486002)(26005)(6512007)(1076003)(478600001)(6506007)(6666004)(52116002)(83380400001)(44832011)(66946007)(5660300002)(2906002)(66556008)(66476007)(4326008)(8676002)(316002)(8936002)(38100700002)(41300700001)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rP4kByhkqLUIzzVZDPkiQRXxFWXXK9cPMYgY2ejedpxQD9rEN2qbCnA3FZhPq8tTfsPOHGBElpCAaU8c7/eFnTUeHLhiAW5sa/a7l64NIIKtXUkrcZsrZEtu5unTiqDNgP1jU3EuUdnq/4J4KYfKLdbcHrlHNzv0Nvu86cdSHaVrXT1vMaQ8j35p5wxvYf3yGwVWBqUx7km0KWkQZwKhzoDIOONOPj9AC7pMlSuxI/SFf63+OG5d2g0c8iHpEegEQktPnsgnkzK+AMbvhJpQDLkS0PgKtf3ElZevegrxPVffXh42ByM1dSVwN/4e/3096YQrEtbEMxiPRvMEFxBzAsyoNSrunW1+pGTDDQ1chLMHr7Sm/pUcMwtvotWnAWYPzGvQnO0dooeobnFFuUTuo/ORPjx4pzZNKg/ALrn8XJUrUmXc8jnhftRE6eEGYjW6r/my/7QTclxsVTh49jiy7IkW8u/57n0P/Fzzr/nG8AibDH2v7VXUcuy7gmTDIgvWglerhRLRgu/EknUOBNpDM92Ir5TZ7gFR/RM5nkJln13mEiTdWmDfMTntnD4/0Dn/kzmSfwTI/WqOig4UP5sy6/rlpztdw0OWr2Fdb4H3s6Ixi0UZXEbRwgGWPZ9lEHt2h80G3DOww2/MSQ+CkCpoTm8b4UI/IKho328C3NTeqPjw2XtDO3iN9eV3fSF1xGnKIS5Gh2FIZtJNhmRVClloMhwS8SX+a/c+FB4Bm5JB8Lmq+DK3gGlsYwQDaeLtj9Bu/bs/9HdSgYIimeSptnpf5flBYa1VID7KOtH1tVauBlMP+ANx9jLIekiyWCVmu/pKbrNom2Kr/rVk1kBz9rG02A4vbUCS4sBx1LZIjDTJ3pfJBR2hr+Rf5mGiIkLZjxzkvtklHZAlusRbs1ygjUulRTXyXhHca2BiPrR1vBzIjuNlrSUKIfHFdtFS+secfOr1PWZrMVtK0Nm5cM41Zz5LF72yf5Xon2BkkCfmWXOftCZIrXvzw4TNWPSjrcIU5DBhUXJEhdvZCZ9YNlx7/yzg5npxNmadBu9X7YGZ4cj5x77PUiVbur9pJrHuiIy/FyxpXRp3UERm3nc4Ggk40ZEpvlJndZMkX+sAo5z7jX5/O5113cCGc6ZZN02GBkVZQrAZP2wXSGsAwSwQ7SxaIUAzkFtNXQ2/8CstIbq+H1vFHff3YtHanqwL+1zAr/bIlZJUudfI0x4jOruFUmWLFTyfTQWOf9/o9BSvFT1TEhEdjxoW7ELKshTQvT/Lguzpp86zcDKoCJprsgCNkFqNLUPJHPMbzX0ywFV92l0WjSREM4OC9YCvr8YQSp93OQMGWVJFmWHnIpi/P4L5VHor7ALwY5PlnIKUOnTOCqcqr7IYB6vrgtD8/FyFmvmCAXVOryM8owu4h5m+IJmHynH67djLh/nCWzlNyXjWFHfaqiybp0KlF6py/SsZgo3fGmllYrtKxAAefVX+tkrjr8+btlwdWnYYVbtgEa+QYsVQ66kLVtMC3Yaqc5WcBh6VAT90aqkjIyjIHwhTJL6Jw31ZWqKiKYLc/oJ5+Fdxe2OJg2fTQhxq+RGxFedzbtQrZrBaRHaYkM6G/ie6p04jg3cAKOWK+w== X-MS-Exchange-CrossTenant-Network-Message-Id: 14bec3e5-e4f5-4fe5-f009-08dbfbea13b0 X-MS-Exchange-CrossTenant-AuthSource: LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 14:44:57.5736 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0d5fd8bb-e8c2-4e0a-8dd5-2c264f7140fe X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JRDBhwdoHk+ek3S9gCN2e3nMzvxXxl47kimshv9aPJqz+3WwLOLXj1wawnpzP551tKQH085I/sJECA+qiBgEIzjAompPhFvT1hwiNXYzlrQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB6535 X-OriginatorOrg: imgtec.com X-EXCLAIMER-MD-CONFIG: 15a78312-3e47-46eb-9010-2e54d84a9631 X-Proofpoint-GUID: 3HXvXT85QxRE-DqSrgYe6VeyxavqQjTW X-Proofpoint-ORIG-GUID: 3HXvXT85QxRE-DqSrgYe6VeyxavqQjTW X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mripard@kernel.org, matt.coster@imgtec.com, donald.robson@imgtec.com, tzimmermann@suse.de, Dan Carpenter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drivers/gpu/drm/imagination/pvr_vm.c:631 pvr_vm_create_context() error: 'vm_ctx->mmu_ctx' dereferencing possible ERR_PTR() 612 vm_ctx->mmu_ctx = pvr_mmu_context_create(pvr_dev); 613 err = PTR_ERR_OR_ZERO(&vm_ctx->mmu_ctx); ^ The address is never an error pointer so this will always return 0. Remove the ampersand. Reported-by: Dan Carpenter Signed-off-by: Donald Robson --- drivers/gpu/drm/imagination/pvr_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c index 6f4e07effad2..432168aba577 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -610,7 +610,7 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, bool is_userspace_context) 0, 1ULL << device_addr_bits, 0, 0, &pvr_vm_gpuva_ops); vm_ctx->mmu_ctx = pvr_mmu_context_create(pvr_dev); - err = PTR_ERR_OR_ZERO(&vm_ctx->mmu_ctx); + err = PTR_ERR_OR_ZERO(vm_ctx->mmu_ctx); if (err) { vm_ctx->mmu_ctx = NULL; goto err_put_ctx; From patchwork Wed Dec 13 14:44:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Donald Robson X-Patchwork-Id: 13491110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DA38C4332F for ; Wed, 13 Dec 2023 14:45:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6696110E7C2; Wed, 13 Dec 2023 14:45:50 +0000 (UTC) Received: from mx08-00376f01.pphosted.com (mx08-00376f01.pphosted.com [91.207.212.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99D3010E7C2 for ; Wed, 13 Dec 2023 14:45:43 +0000 (UTC) Received: from pps.filterd (m0168888.ppops.net [127.0.0.1]) by mx08-00376f01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BDDU2F2028726; Wed, 13 Dec 2023 14:45:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-type:content-transfer-encoding:mime-version; s= dk201812; bh=mKqL3hGSVWIOEB+LEXIpZX/b9JJN6fAwNwZP7XgmFz8=; b=pIv 6Ydm7jKiU5S2FQu7KmI2FE0DrfGJoz4lkpcXrXFQqa/DaWgiYzEbq3HvjpamZTJR fe2WV5jaWu0xraaxjLntkCn2e9By3eDRH49KIbJAJ+RmR/jM9m/5nujwjIj6EWbR mbo1ce/M0PUPze0K/RXMDMW1mvMZmaLpbYv58L0BI6XrtXNW+u2zKBm5DAzxSCwk E5116Z+9l4IEXRVK7Xs1ptMQddHg4S4SCrGsXOxGtmWH0bgnFXDEXVfPkGKBnwQi 2MMofM7UK30kVoqyh/3yC8X+gFBLK9TnL1gNgT3+REDIG6avw6oi3Jemxh7swf+J UsuxT5Hv+oCAwVyfusg== Received: from hhmail04.hh.imgtec.org ([217.156.249.195]) by mx08-00376f01.pphosted.com (PPS) with ESMTPS id 3uvfcsan3m-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 13 Dec 2023 14:45:00 +0000 (GMT) Received: from HHMAIL05.hh.imgtec.org (10.100.10.120) by HHMAIL04.hh.imgtec.org (10.100.10.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 13 Dec 2023 14:45:00 +0000 Received: from GBR01-LO4-obe.outbound.protection.outlook.com (104.47.85.105) by email.imgtec.com (10.100.10.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 13 Dec 2023 14:45:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kLeCJP9l10EBtJLtmlSlNDltIaVFkOIISGG4cLLbK/uevRsv2Qb8J7k2fWKywxw9e3ESgZpHulyaQ/E046elrnpDiUpOp6yKFwQc8vVuMexfy4TI/UhixdDR8CVLBndXI1auymxDSOYPyW0Xzr/ifS6tzP2yE4jRnDpCWv0dztrc17/0gLhpvxvqZW7Y64MztOiZqljUriEdhSe+SZvtC7lbrxw0USsab3SQlSuakgR9LjWUf5UTVEwBxRigB0jp44iumevoK2NP0Dn4UjIQsP4H0JUPq5EGm0cQA/0yEXcEQXx4JHdZ/Mi81+hZdK5M3hXdDrt15ywo4t8gbDePCA== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mKqL3hGSVWIOEB+LEXIpZX/b9JJN6fAwNwZP7XgmFz8=; b=NhcpnpCSymnamNhhWcUZnGYXK5kpOMqElOYvqYXeQVjsWc/8A8g32czs0oPrzOJd4BjV5C0cYv19mHBT7TkjuGb0mrj9k/r2zDfZspvy3J5yQnHJF+1wB87xEkJGmE8/7Z4+b+DJp0/Z74oYzdPtjJ1qfz00tOv9hYEFx3SH9tLfRFI3NiWkwDRMXFckVIe0oRZ7gdoIOei2Mt+zJT+NJAnTUWlsLJe1p4o919DKbuJH/EtiebkXHY2sS5yVahV4736vw8Q5ol/sHiKbN9jNt3EpfhXuW+PYhYtRvQJAtH+3IS8eSPh5vB6haALMg8eMkLjR1bS86F/Q/IOU7diObA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=imgtec.com; dmarc=pass action=none header.from=imgtec.com; dkim=pass header.d=imgtec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=IMGTecCRM.onmicrosoft.com; s=selector2-IMGTecCRM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mKqL3hGSVWIOEB+LEXIpZX/b9JJN6fAwNwZP7XgmFz8=; b=fNwNtvw9PULy9FDAarQMmVbjuZ8qFErQ2ic0PdsQ7EFQtRO3rAl59Hz5fiyQ8CBUPCA/gLLDUD9LhyTA69580qNyBRdNx2hLDat3btdSFnAR6hWUMlqVEWGf29whVe5SR1Zor6sCkYjI1MPLKwh4HHsbeLrKDgTVM+o+SAJHB5s= Received: from LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:23c::11) by LO0P265MB6535.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2d0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 14:44:58 +0000 Received: from LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM ([fe80::a3f5:aa1a:ff75:79a2]) by LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM ([fe80::a3f5:aa1a:ff75:79a2%4]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 14:44:58 +0000 From: Donald Robson To: , Subject: [PATCH 2/2] drm/imagination: Fix error path in pvr_vm_create_context Date: Wed, 13 Dec 2023 14:44:31 +0000 Message-Id: <20231213144431.94956-2-donald.robson@imgtec.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213144431.94956-1-donald.robson@imgtec.com> References: <20231213144431.94956-1-donald.robson@imgtec.com> X-ClientProxiedBy: LO4P123CA0332.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::13) To LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:23c::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2P265MB4600:EE_|LO0P265MB6535:EE_ X-MS-Office365-Filtering-Correlation-Id: a2d9e9ce-fd66-4151-ea94-08dbfbea144b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tq2er1L7UFHfA5+FhSj91AtFNeIFbeOBwWgv2t4FxQibLHAxkQte5sa2CerZFpLNydgGMRTCCua4zi0pA4Nk2NvawyLERnXqXOUUY2NCGPCdfD2/jv+X5Xo9RVAq3BUI/Y82zmjw1GaqAP9apzY2+t57ctPZU0VWvoXoTciSUx0ZWnmIQsn8aEWznCwiWSyq7ydido9o9maNRBEmGimodZXt5bQQzaY/D7jSyO8CvFNfGRNhQOhvxToz3Dn1p7AIftbKK5r3ttQPS9GtdXWi+IKD3JJUar7SIU66sNMSDG0yzD6sA4bvXpeEqdmxNuwVR6bS5fqLvQoylBW3o3DbyVSx8CFb0RUOjmfInz8uz0PoNCVZvyv2zN5kilos6ib4VdQqRPZq/kQPABFjvRr/I1ZyGQkJdvld+O540COgLtFXrShNW7IkGtqsbFz9DWamqJ37+BP/jCCBtsrIY/pPm2pTrMxEPPSJP24DqUIWqnigxZtEJypbyFNEcGxtcAt5z4Ise0Nwy0H/pKL2NLddmGsSjVS/pUa8cyCbXerSZk4r7uf/POyfTrdwKo2lAyN+wNRfmlKHguboKJZacKXY7b1EPp33cN+7KSNxu75y0gYDH2txLYIIOVFgUO+3wtZm X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39850400004)(396003)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(2616005)(6486002)(26005)(6512007)(1076003)(478600001)(6506007)(6666004)(52116002)(83380400001)(44832011)(66946007)(5660300002)(2906002)(66556008)(66476007)(4326008)(8676002)(316002)(8936002)(38100700002)(41300700001)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7Jga54YgxejQKck1Y/7bNnTkMDPy?= =?utf-8?q?FHu1UWcKUHRDwVwWiFpFsm74CCq60k1fd+Yl8IaGAAOFtX1EKGR5op+q/1JFhi7J0?= =?utf-8?q?VlD7F7Cpyfr+dy5m+gbLSm0WQ3Mphk27BFZX7ceYr5+iEQoVy4eWQPsyLgr/vrd++?= =?utf-8?q?XpgiL74QQNsWkhC3kn+CPEtzmX+LxKy0kQXKUJOFqrAkDF24mxHDAUySMUsVpdJRw?= =?utf-8?q?TsdcWTA0kNgutXhcqiRkE0EaBMr1elHzGj0jPuHB6Mc4Zo6WIsA+zsIOTN16VcCcS?= =?utf-8?q?lhpzB+Db+XvuRofItu9culDGP2x+egmHcpb1QOX/mxRjBlGQWqAqlM1vNeWVwAE0T?= =?utf-8?q?Hd/9RBsZWLPG/w3yDvDFJDEEGlbvddqNPOBxOUu/q7F5PdMpkwvhQ3LyXTm7aI2/p?= =?utf-8?q?+UPrefLi9HK2dr17jes2KVufgKH7gHU+flHFOk9XU/5gbGiF7mITKq6iun26Ialjl?= =?utf-8?q?cX0INF7wGL/ylH8CO9BFRbFCn7V3lv8LySWAGCdY3ybFZp7WtyhF+2RoUS9vexhkF?= =?utf-8?q?S3wabG99N/PDVWmJl+BZ4ux/PiE33WkXDjArM/dvSjSSVWELe3OpPFuZ4+QitraKs?= =?utf-8?q?Z74UJqKMk96ks/MaGl90TcHD1NP+TZAhZvr+ZQM7O4etaThwuid5qFMep+gGmx00q?= =?utf-8?q?CJbrMZcRWyv0H4ijmDyq+bGOnqRbZsIC4Ldq7IVxj+l2yTGWHJCYxbN8rxpBQF0n8?= =?utf-8?q?Lu1EwvPAmBlfR3KR7Tkr6kGdP9E3j9afHWkc7PhCDAKyLBWk1i4SFSQ0B8NcXQQWZ?= =?utf-8?q?3u7cQ0DKY+d63XuibmhNXOk07mUqR53oz6BEQNWRE/jmR5nJZZ1RtihXdtfgt95OC?= =?utf-8?q?mPwLhkAKT7yTyeU9eXWaYumraT33xApZ9tGr9ehkmXBlhGvv4OKoasC6nrC98CZdB?= =?utf-8?q?8v2QNMKhdUU08DJKxNN2h6XgsCVw8Ec323jy1IORCfCDBOGITTsiN3egHSq+RDXKD?= =?utf-8?q?8qnf9fjlnvDE+c8IyIzJmA+QdKd/LmenLQM1piIRUP7y4Q8fUwDwKJ9eWI/NtM5/x?= =?utf-8?q?PPkEF+SFfHNbW57+0LAUd0AWBNIK4mJ7NdaIdbK3JnDzAXx2QPPrSBYMxQ5vnhB0b?= =?utf-8?q?glduW3LaT8YTiWlJrv3M1ZxYFtByw9PTrgxuJjdJNtArNB23CsoCo9mZWOvYDxhYv?= =?utf-8?q?P6NoNp7T331NTQSYrjUAllauFuycl1qG688Ua6sSsw7vbLyzHIDzO1bAH1R1N6Zoh?= =?utf-8?q?xED9z/4aYsTVh4W93XAx/PAIlWzP2P/tU+8oRWThKCkY5NQv/8V9CMB7+tSIv6YQr?= =?utf-8?q?UahSzk9Sa8dDYtk+s0ieHAeR9ho7Hk01LPk00pco/YzvepYdvy5X4YWMGhdm24jZV?= =?utf-8?q?mZG1cdAukM1j5xik8XGwQMkuhNTkOQA/RAlbd5ujKyUnVpJemwMnmHRHylJFt4YP3?= =?utf-8?q?MGkAAtSjhKho+4+r6JmdPa9PA21473xDDa3YtxjHfSdvGfzKQSfQDQrqwzVJzTkbN?= =?utf-8?q?MoPjyiboAF86YUr18/T+6Oevo9j0NxuL/SB9PCZoAAXXhzCe4qMwsx+8UAi+YV+bC?= =?utf-8?q?ooTodAKfJ36mXxpjIzpA0w37KRk2rIw4Aw=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: a2d9e9ce-fd66-4151-ea94-08dbfbea144b X-MS-Exchange-CrossTenant-AuthSource: LO2P265MB4600.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 14:44:58.5801 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0d5fd8bb-e8c2-4e0a-8dd5-2c264f7140fe X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: C4hHqb50eZMuPwBIgybp32iXdFDNXsX0kGTRXOPsyJNuRkeBNL/46y73CwQIP1r4g+hERyx1lRkLQcUgBph62Go3Wr3m5DmmwFrb+kVG3A8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB6535 X-OriginatorOrg: imgtec.com X-EXCLAIMER-MD-CONFIG: 15a78312-3e47-46eb-9010-2e54d84a9631 X-Proofpoint-GUID: VisxgRGilwb-l1GAxT7Qt03AVJ-pD4pi X-Proofpoint-ORIG-GUID: VisxgRGilwb-l1GAxT7Qt03AVJ-pD4pi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mripard@kernel.org, matt.coster@imgtec.com, donald.robson@imgtec.com, tzimmermann@suse.de, Dan Carpenter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It is possible to double free the vm_ctx->mmu_ctx object in this function.     630 err_page_table_destroy: --> 631         pvr_mmu_context_destroy(vm_ctx->mmu_ctx); The pvr_vm_context_put() function does:         kref_put(&vm_ctx->ref_count, pvr_vm_context_release); Here the pvr_vm_context_release() will call:         pvr_mmu_context_destroy(vm_ctx->mmu_ctx); Refactor to an unwind style. Reported-by: Dan Carpenter Signed-off-by: Donald Robson Reviewed-by: Dan Carpenter --- drivers/gpu/drm/imagination/pvr_vm.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c index 432168aba577..93155eccc50d 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -598,23 +598,12 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, bool is_userspace_context) if (!vm_ctx) return ERR_PTR(-ENOMEM); - drm_gem_private_object_init(&pvr_dev->base, &vm_ctx->dummy_gem, 0); - vm_ctx->pvr_dev = pvr_dev; - kref_init(&vm_ctx->ref_count); - mutex_init(&vm_ctx->lock); - - drm_gpuvm_init(&vm_ctx->gpuvm_mgr, - is_userspace_context ? "PowerVR-user-VM" : "PowerVR-FW-VM", - 0, &pvr_dev->base, &vm_ctx->dummy_gem, - 0, 1ULL << device_addr_bits, 0, 0, &pvr_vm_gpuva_ops); vm_ctx->mmu_ctx = pvr_mmu_context_create(pvr_dev); err = PTR_ERR_OR_ZERO(vm_ctx->mmu_ctx); - if (err) { - vm_ctx->mmu_ctx = NULL; - goto err_put_ctx; - } + if (err) + goto err_free; if (is_userspace_context) { err = pvr_fw_object_create(pvr_dev, sizeof(struct rogue_fwif_fwmemcontext), @@ -625,13 +614,22 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, bool is_userspace_context) goto err_page_table_destroy; } + drm_gem_private_object_init(&pvr_dev->base, &vm_ctx->dummy_gem, 0); + drm_gpuvm_init(&vm_ctx->gpuvm_mgr, + is_userspace_context ? "PowerVR-user-VM" : "PowerVR-FW-VM", + 0, &pvr_dev->base, &vm_ctx->dummy_gem, + 0, 1ULL << device_addr_bits, 0, 0, &pvr_vm_gpuva_ops); + + mutex_init(&vm_ctx->lock); + kref_init(&vm_ctx->ref_count); + return vm_ctx; err_page_table_destroy: pvr_mmu_context_destroy(vm_ctx->mmu_ctx); -err_put_ctx: - pvr_vm_context_put(vm_ctx); +err_free: + kfree(vm_ctx); return ERR_PTR(err); }