From patchwork Tue Nov 28 20:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13471727 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F0F5CC4167B for ; Tue, 28 Nov 2023 20:19:41 +0000 (UTC) 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: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:In-Reply-To:References: List-Owner; bh=lDWRe20K6ZhmplDkPtO59nhW5Y2ZAPVMB5BV0kEz2po=; b=dbi8OdJ73l9KWC EcRPQF040UmTv+28uy1g4cJLJa+O+WkxDR0cKXzj402XtZ9uCP0veZiSIuv24Omtu5lnwHYgMWdX5 Zd/Grc4aXHYKlshEuA08ZSjALeaH6Z6hZr3/E2AZkGoyJQiPUwn+12NtNeFn23vixBP+nB+KL9LA4 r9LDiLCTVSopsuVdLx5Ua2bbhoNY2rlh9It7EEOZTknUvH649vu3YoE0fIaT6eVXT/UvFJeS//xjx K2jlurDCj6p+UFPSomuOdHLWS3ddE3Wg5xjmaNCqwTfy7FVyITiuJEgLPlyXGNG1rKWAvoQ1mcQeZ FFCzPxxYR/ojc9mbor2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r84Y8-006F8x-0U; Tue, 28 Nov 2023 20:19:16 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r84Y5-006F7y-2D; Tue, 28 Nov 2023 20:19:15 +0000 Received: from umang.jain (unknown [103.238.109.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D1D0FBEB; Tue, 28 Nov 2023 21:18:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701202715; bh=Aw14YJcNorrt7GqxRG70LVe8RNenb1dxIcHiuL2EocE=; h=From:To:Cc:Subject:Date:From; b=s1cbKcHMuETH8tjDHfd10XsNBn6OKRta+xKL8AuMd80BmoFSffl7k/dAM1IZiyWXT fNnBs3BXM6nM/NoGU4NAJpvogwjWVpyubC94bBCVwrBkj7LPxErKz2TKfw0PXnDNqt eAWabhnJxC9cciN0d+HogOCrpYyl/TqBwXBFHXgU= From: Umang Jain To: linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Dan Carpenter , Kieran Bingham , Laurent Pinchart , Dave Stevenson , "Ricardo B . Marliere" , Umang Jain Subject: [PATCH v2] staging: vc04_services: vchiq_core: Log through struct vchiq_instance Date: Wed, 29 Nov 2023 01:48:45 +0530 Message-ID: <20231128201845.489237-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231128_121913_866285_CC30B5B3 X-CRM114-Status: UNSURE ( 9.00 ) 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 The handle_to_service() helper can return NULL, so `service` pointer can indeed be set to NULL. So, do not log through service pointer (which can cause NULL-deference), instead, use the vchiq_instance function argument to get access to the struct device. Fixes: f67af5940d6d ("staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug") Reviewed-by: Ricardo B. Marliere Signed-off-by: Umang Jain --- Changes in v2: - Separate out from patch series: [PATCH 1/9] staging: vc04_services: vchiq_core: Log through struct vchiq_instance - Add missing space in FixeS: tag --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 0468689a6325..e0022acb4c58 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -245,7 +245,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return NULL; } @@ -287,7 +287,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return NULL; } @@ -310,7 +310,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return service; }