diff mbox series

[1/9] staging: vc04_services: vchiq_core: Log through struct vchiq_instance

Message ID 20231107095156.365492-2-umang.jain@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Smatch fixes and remove custom logging | expand

Commit Message

Umang Jain Nov. 7, 2023, 9:51 a.m. UTC
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 will 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")
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Greg Kroah-Hartman Nov. 23, 2023, 12:57 p.m. UTC | #1
On Tue, Nov 07, 2023 at 04:51:48AM -0500, Umang Jain wrote:
> 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 will 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")

You need a space there :(
Greg Kroah-Hartman Nov. 23, 2023, 12:58 p.m. UTC | #2
On Tue, Nov 07, 2023 at 04:51:48AM -0500, Umang Jain wrote:
> 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 will 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")
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c  | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Also, please send this as a stand-alone patch so we can apply it for
6.7-final.

thanks,

greg k-h
Laurent Pinchart Nov. 23, 2023, 1:42 p.m. UTC | #3
On Thu, Nov 23, 2023 at 12:57:33PM +0000, Greg Kroah-Hartman wrote:
> On Tue, Nov 07, 2023 at 04:51:48AM -0500, Umang Jain wrote:
> > 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 will 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")
> 
> You need a space there :(

I have this in my .bashrc:

gpf() {
	git show --pretty=fixes -s ${1:-HEAD} | wl-copy
}

It's quite handy.
diff mbox series

Patch

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 39b857da2d42..8a9eb0101c2e 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;
 }