Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4500961ioa; Wed, 27 Apr 2022 05:19:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiXC8w0wmAex1cyuBzhgbooR4VSac+GzDLxiA0vt9/ocG5332IzsCiec+wM7T35wwnjdMt X-Received: by 2002:a17:90a:c02:b0:1d6:48b:176c with SMTP id 2-20020a17090a0c0200b001d6048b176cmr36678936pjs.146.1651061980138; Wed, 27 Apr 2022 05:19:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651061980; cv=pass; d=google.com; s=arc-20160816; b=zoTFjOmteRi+jDqkC3UuFWje64V8nASfVf8xOBUdJBR32XBUu0AeHLsJv+OINZoNZ2 bDEfiaP4NuWBgVmWuaSBEROi7X8TWT/5uOGTPYewAc+W7HmtlZzb0G11c4u2rnM5tamH sIS8F8YN9dUlx2YAVk/gYm26hQ3y3RGI1DdN9lC3vDGi4mz1gHocyKGGgwdMG6kOUlGs TTc1qIlTB7460G+GjeJfUbtt8HzUGn1BGc4FyLj+iLmYiCSr6/cRCVn59zEu2gLI9MBw cBPiBlnIV/WhSlOkBjnJmGgVxq/OdD9c69UKGaWQkHjoDZv8d6NN4bihbZ/7l+ogzGCV 9VwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=hQtFNueahf9C1mL7BMnGGQiZUBUPxSj88/NO3oy1340=; b=aZHcl7Ibb9aS0qcRa6vS9PLUVkynBjYIx76mZ19TlaEtxr4dmcWKL+i0X5Q4skz9C+ s+3vKiesXcmMbHNqnCCO7JZFa5FhfdyTaQsuRiju5CMZQmshrhlhS5fuKcR5zLpCRRhd zCaQx2fRuApVZy2EG2aKEsy94EqiQnFkEa1/cA2MYcZLIO6qyfDoYal4S40GQbj7qgJS 5/xgIVN4rHbsFDBjMBZdnCLc8+9lM1WT0YanDi8/bTzNXaWciff3nT5sYcQ5CJEhBWPS CRyYrMgWiLWtbk7rqSR9ZcmQvBXmkQyqOX8jBpQEhAgM7Ler1ngDyPDLw5F6mnj8/9AN gmnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo0.onmicrosoft.com header.s=selector2-vivo0-onmicrosoft-com header.b=KaEDor7i; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 142-20020a630094000000b003ab02b38766si1321748pga.435.2022.04.27.05.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 05:19:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo0.onmicrosoft.com header.s=selector2-vivo0-onmicrosoft-com header.b=KaEDor7i; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 638622ED5A; Wed, 27 Apr 2022 04:55:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233209AbiD0L6m (ORCPT + 99 others); Wed, 27 Apr 2022 07:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233060AbiD0L6l (ORCPT ); Wed, 27 Apr 2022 07:58:41 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2134.outbound.protection.outlook.com [40.107.215.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E4332E9FF for ; Wed, 27 Apr 2022 04:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PtMJezANPcfcnMcTHUDiGcqF24dDP+VzCIuTwcXjOHThDcDEwPZMuTbPBOXxgegd0e1qOYOBKUuIL+97vWBJNd32PdLSe00c/3vnY3YtKnmki3Km23/serMBOSc1o7zX/rB7HIARCRTKDT8b09NQ8wT0iAjmsQf0yGbx6uTv91fL44+9Qihxf8D+D27vZY2QF1gUo0v9tap3/UJDwnNZTtOAgfUjfEjLZClhEaDgA2vxb0DKAoCp+YPfRi/Go4Rn+Ju7uPdJrtVZz3v3VHc9gzaMDX5RUMoW73RXWtNIUDOmC9hcOIp5bEPnfeRKSUJThF97O6jWMkO0ltKqJaDvnw== 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=hQtFNueahf9C1mL7BMnGGQiZUBUPxSj88/NO3oy1340=; b=oJHyeL0E2P6GJ7QJqmYjwVLLRFrDYeD76zbjH/tkPBbZF3Vxn5gzNrn+TIFDGoc2Vg7wgQQZ0nR3KQDZOgpbnZdw2BAT5EirKIJQ88e4IxSxrfG8CSsCeE6oSTwKGUcz009vMWU91wgGzIpfJUGtp5AJjb3Z1Pz3nkxK9k/HvTapQzXWo8Kp8ETXBVn5hlS8ClACuynNqHIgPy1+vz/FBH1k40mo2lh434S0NweUgLdv3R/hd54BzwrGdRhW8GwVeev43ndYdupuXI2V+rF/xtNRBYH+kkFuvALn44ZpV5CYIZfv8U/glaaYwKow1SlxC8ETWBuJxx/MfDGqYVtT4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hQtFNueahf9C1mL7BMnGGQiZUBUPxSj88/NO3oy1340=; b=KaEDor7iAUB1z8hDLx47/e0WdXzSyeYkonnXlDkvYQuuINKEdrc4zwxsjuCj7TRyPjUMwSj9Bq5EjdNc3qiFBq/Z6ogqQFsf9oYuV0EzdD9X6QBas1q9JfV6gsGs6e+8+F/ygGOYU5apQtlEzNvjbWkVWhnIwmxgVOIEYGQNPVY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SG2PR06MB3367.apcprd06.prod.outlook.com (2603:1096:4:78::19) by PSAPR06MB3992.apcprd06.prod.outlook.com (2603:1096:301:37::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Wed, 27 Apr 2022 11:55:26 +0000 Received: from SG2PR06MB3367.apcprd06.prod.outlook.com ([fe80::4591:4f3e:f951:6c8c]) by SG2PR06MB3367.apcprd06.prod.outlook.com ([fe80::4591:4f3e:f951:6c8c%7]) with mapi id 15.20.5186.021; Wed, 27 Apr 2022 11:55:25 +0000 From: Wan Jiabing To: Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Wan Jiabing Subject: [PATCH] i915/gvt: Fix NULL pointer dereference in init_mmio_block_handlers Date: Wed, 27 Apr 2022 19:54:56 +0800 Message-Id: <20220427115457.836729-1-wanjiabing@vivo.com> X-Mailer: git-send-email 2.35.3 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: HK0PR01CA0057.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::21) To SG2PR06MB3367.apcprd06.prod.outlook.com (2603:1096:4:78::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d925f00-9904-4202-5482-08da2844d086 X-MS-TrafficTypeDiagnostic: PSAPR06MB3992:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0HJt0DbFgy+Hua5HYH1gPSh6qlkCQ7LxUHIx8h+CVHLCZaIkqiOmTQ0hbIVLdxYt0pa8rdcCPGyNeIb2TJdkRMeGVcx7tf9bC3T98WPcDFTwrYamWlM7Gnt7OmzRuclTis/fgL73bay6+YXUjVdaSBedL02tDuWxxhy1EwbrV1xC6Z3YynimRPHnWI7zP+80ze4Fghnzu/a6VRkJJlNJwXbu+DU3n5y+NVtz2q0ki6L/itjZzSPK7wwYmzZ5ElPntsm6Dz15/2c4/RSBv5IOPJrmhoxcM1iVn/i8GsNOG415cHV9slrloyyzpZCpypc28d/Ymcm6dh2SNzOesTgteUOmYoFnCaaGyApVeSWvl2jlIqn3ngYDryjr7eVTHmqvI/YtwW5B5tal/kl5Gdq/VeWDljtQUUWlAf+W7wK3cpZyt9WGdBKnlPv4/7oNjDUulYFy7ZcBpsrnBeMGgyhZOoURsn6DOz1pwbuCZAY/yrLW+SHLJKB6/nwH10v/+klZh3VoWwLiR0c8XtoIo7hBWlzoJoXpFKH8J9g96K7PPTKpmULmM68NhFtfIWImbNjsIA7/fyGUv0k1cqmdymYBcxDbxkg9AfdktHkOB+zqL5RyMwZXj5WqOSiPLRnojji6Y0JMgdX5OeoNtbGlxBRMEMHFqemI4inCYX20I0iwuQyi7liqNG+SVjjLB0zSB2y4yulTDAUSDkNSCpmS0DhNKw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR06MB3367.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(110136005)(38100700002)(83380400001)(38350700002)(6506007)(186003)(1076003)(86362001)(508600001)(7416002)(921005)(5660300002)(8936002)(4744005)(2906002)(6486002)(26005)(52116002)(2616005)(66476007)(4326008)(36756003)(6512007)(8676002)(66946007)(66556008)(316002)(107886003)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?mVswxLF4DPyKZyol2LOCj0ocz1yY5POlspM0EF+uPVxlp+QJe1mkTcMyCbJe?= =?us-ascii?Q?ItuqdFNHzz4772yH0SIiZsGvD304VTzVqxLxiW2NXggE1NJT/UwXDeQrez2F?= =?us-ascii?Q?yDO8HB1Rvz1kATl/YikqxDmJUdnFZQ3UBqIzeLysLiOBMesXFCwlMq7xf8Uk?= =?us-ascii?Q?Yu9FzfJpRbGNxI0OaOeSywQ3JcV2JG+8lel761XCQq7pP4/5r8lTn2tDLE3k?= =?us-ascii?Q?gPFOGbMec1/bswH5w30H/KMKMVbr1GBqPamGcpiB2h0h5hY1mMdtoc3dXpaj?= =?us-ascii?Q?E3+ZwArqjJZQ9OEMHD5owiQ8ElKXYUcTXS8eLehCKBmzlQ733oAOxckv8Cpu?= =?us-ascii?Q?27dXB12iHHBIu54qWGGfBLcWoXoi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ZbwRyiE0usOtXU//AaTDUObBonUjxSjDHyNQR5yqX4zpWIt4hySxzt?= =?us-ascii?Q?S6ilYSyoTBhOYGoL6Euxcr8UNbf3G6cI2K3675yZeg5K8hiVZARq8YJNVXUi?= =?us-ascii?Q?4eLr2fhruBmE+FNh2TULNNMxgPgtShzKzRvc+yinlMmjMiXVt7a3ZWYxCcAv?= =?us-ascii?Q?5l4/xV7aqUzl7/1jiJrudNJe3L3yGWpv7ASliF5yW53q95nJflIeJBLk8bXj?= =?us-ascii?Q?aEPpOMJEkdGER64Drfpm4StIajiDLwuWmRcgfeg9cX7cLJ/2WghZKbQO3kK0?= =?us-ascii?Q?8Oo8Pqz8ArjfPjYYHHMuQ5PvbWNbhAIP5rAHJpQsmMwN+I9/eIUR3nvB57C4?= =?us-ascii?Q?f6ZzQYMP25mYh6/aZBu1digJMoFqfRDQcuu8DJwYuDN4VU2OF6xDRGdMH3RH?= =?us-ascii?Q?29zkoNyP/ljKkr61var84BggyJcYbs685I+Zy6l6ZHiWP36mYGgWQG38iP14?= =?us-ascii?Q?e4KYAFCi4g=3D=3D?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d925f00-9904-4202-5482-08da2844d086 X-MS-Exchange-CrossTenant-AuthSource: SG2PR06MB3367.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2022 11:55:25.0510 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7sJBd54IljHaomMkdlcCNBN+1vOvz19Sltf32TuY6O3hJIS3leWpt2UEoJYhoNyfhSm2f2oYIyVtmSFfG5Ox3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB3992 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix following coccicheck error: ./drivers/gpu/drm/i915/gvt/handlers.c:2925:35-41: ERROR: block is NULL but dereferenced. Use gvt->mmio.mmio_block instead of block to avoid NULL pointer dereference when find_mmio_block returns NULL. Fixes: e0f74ed4634d ("i915/gvt: Separate the MMIO tracking table from GVT-g") Signed-off-by: Wan Jiabing --- drivers/gpu/drm/i915/gvt/handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c index cf00398c2870..7ffe0fb512a9 100644 --- a/drivers/gpu/drm/i915/gvt/handlers.c +++ b/drivers/gpu/drm/i915/gvt/handlers.c @@ -2922,7 +2922,7 @@ static int init_mmio_block_handlers(struct intel_gvt *gvt) block = find_mmio_block(gvt, VGT_PVINFO_PAGE); if (!block) { WARN(1, "fail to assign handlers to mmio block %x\n", - i915_mmio_reg_offset(block->offset)); + i915_mmio_reg_offset(gvt->mmio.mmio_block->offset)); return -ENODEV; } -- 2.35.3