linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer
@ 2023-11-28 20:20 Umang Jain
  2023-11-28 20:20 ` [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address Umang Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Umang Jain @ 2023-11-28 20:20 UTC (permalink / raw)
  To: linux-staging, linux-rpi-kernel, linux-arm-kernel, linux-media
  Cc: Stefan Wahren, Greg Kroah-Hartman, Dan Carpenter, Kieran Bingham,
	Laurent Pinchart, Dave Stevenson, Ricardo B . Marliere,
	Umang Jain

%lx is used to print the unmodified pointer address for debugging.
%p will print the hashed pointer address to avoid leaking information
about kernel memory layout to userspace. But when `no_hash_pointers`
is passed as kernel parameter, unmodified pointer address will be
printed.

Hence, drop %lx in favour of %p. For debugging purposes, one can
easily depend on `no_hash_pointers`.

This also solves the following smatch warnings:
service_callback() warn: argument 7 to %lx specifier is cast from pointer
service_callback() warn: argument 11 to %lx specifier is cast from pointer
service_callback() warn: argument 12 to %lx specifier is cast from pointer
service_callback() warn: argument 13 to %lx specifier is cast from pointer
vchiq_release() warn: argument 7 to %lx specifier is cast from pointer

Changes in v2:
- Built/Rebased on top of:
  [PATCH v2 0/5] staging: vc04_services: Drop custom logging

Umang Jain (2):
  staging: vc04_services: Use %p to log pointer address
  staging: vc04_services: Use %p to log pointer address

 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c  | 7 +++----
 .../staging/vc04_services/interface/vchiq_arm/vchiq_dev.c  | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address
  2023-11-28 20:20 [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Umang Jain
@ 2023-11-28 20:20 ` Umang Jain
  2023-12-04  7:07   ` Greg Kroah-Hartman
  2023-11-28 20:20 ` [PATCH v2 2/2] " Umang Jain
  2023-12-04  7:08 ` [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Greg Kroah-Hartman
  2 siblings, 1 reply; 5+ messages in thread
From: Umang Jain @ 2023-11-28 20:20 UTC (permalink / raw)
  To: linux-staging, linux-rpi-kernel, linux-arm-kernel, linux-media
  Cc: Stefan Wahren, Greg Kroah-Hartman, Dan Carpenter, Kieran Bingham,
	Laurent Pinchart, Dave Stevenson, Ricardo B . Marliere,
	Umang Jain

Solves the following Smatch warnings:
service_callback() warn: argument 7 to %lx specifier is cast from pointer
service_callback() warn: argument 11 to %lx specifier is cast from pointer
service_callback() warn: argument 12 to %lx specifier is cast from pointer
service_callback() warn: argument 13 to %lx specifier is cast from pointer

%p will print the hashed pointer to dynamic debug.
In order to print the unmodified pointer address, one can use the
`no_hash_pointers` via kernel parameters.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 0db5541e42cb..600beea50453 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1087,10 +1087,9 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
 	rcu_read_unlock();
 
 	dev_dbg(service->state->dev,
-		"arm: trace: service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx\n",
-		(unsigned long)user_service, service->localport,
-		user_service->userdata, reason, (unsigned long)header,
-		(unsigned long)instance, (unsigned long)bulk_userdata);
+		"arm: trace: service %p(%d,%p), reason %d, header %p, instance %p, bulk_userdata %p\n",
+		user_service, service->localport, user_service->userdata,
+		reason, header, instance, bulk_userdata);
 
 	if (header && user_service->is_vchi) {
 		spin_lock(&msg_queue_spinlock);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] staging: vc04_services: Use %p to log pointer address
  2023-11-28 20:20 [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Umang Jain
  2023-11-28 20:20 ` [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address Umang Jain
@ 2023-11-28 20:20 ` Umang Jain
  2023-12-04  7:08 ` [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Greg Kroah-Hartman
  2 siblings, 0 replies; 5+ messages in thread
From: Umang Jain @ 2023-11-28 20:20 UTC (permalink / raw)
  To: linux-staging, linux-rpi-kernel, linux-arm-kernel, linux-media
  Cc: Stefan Wahren, Greg Kroah-Hartman, Dan Carpenter, Kieran Bingham,
	Laurent Pinchart, Dave Stevenson, Ricardo B . Marliere,
	Umang Jain

Solves the following Smatch warnings:
vchiq_release() warn: argument 7 to %lx specifier is cast from pointer

%p will print the hashed pointer to dynamic debug.
In order to print the unmodified pointer address, one can use the
`no_hash_pointers` via kernel parameters.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
index 98a60fee3d9a..3e3bf842d20e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
@@ -1201,7 +1201,7 @@ static int vchiq_release(struct inode *inode, struct file *file)
 	int ret = 0;
 	int i;
 
-	dev_dbg(state->dev, "arm: debug: instance=%lx\n", (unsigned long)instance);
+	dev_dbg(state->dev, "arm: debug: instance=%p\n", instance);
 
 	if (!state) {
 		ret = -EPERM;
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address
  2023-11-28 20:20 ` [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address Umang Jain
@ 2023-12-04  7:07   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-04  7:07 UTC (permalink / raw)
  To: Umang Jain
  Cc: linux-staging, linux-rpi-kernel, linux-arm-kernel, linux-media,
	Stefan Wahren, Dan Carpenter, Kieran Bingham, Laurent Pinchart,
	Dave Stevenson, Ricardo B . Marliere

On Wed, Nov 29, 2023 at 01:50:06AM +0530, Umang Jain wrote:
> Solves the following Smatch warnings:
> service_callback() warn: argument 7 to %lx specifier is cast from pointer
> service_callback() warn: argument 11 to %lx specifier is cast from pointer
> service_callback() warn: argument 12 to %lx specifier is cast from pointer
> service_callback() warn: argument 13 to %lx specifier is cast from pointer
> 
> %p will print the hashed pointer to dynamic debug.
> In order to print the unmodified pointer address, one can use the
> `no_hash_pointers` via kernel parameters.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c  | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Does not apply to my tree, is it because I just took your other patch?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer
  2023-11-28 20:20 [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Umang Jain
  2023-11-28 20:20 ` [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address Umang Jain
  2023-11-28 20:20 ` [PATCH v2 2/2] " Umang Jain
@ 2023-12-04  7:08 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-04  7:08 UTC (permalink / raw)
  To: Umang Jain
  Cc: linux-staging, linux-rpi-kernel, linux-arm-kernel, linux-media,
	Stefan Wahren, Dan Carpenter, Kieran Bingham, Laurent Pinchart,
	Dave Stevenson, Ricardo B . Marliere

On Wed, Nov 29, 2023 at 01:50:05AM +0530, Umang Jain wrote:
> %lx is used to print the unmodified pointer address for debugging.
> %p will print the hashed pointer address to avoid leaking information
> about kernel memory layout to userspace. But when `no_hash_pointers`
> is passed as kernel parameter, unmodified pointer address will be
> printed.
> 
> Hence, drop %lx in favour of %p. For debugging purposes, one can
> easily depend on `no_hash_pointers`.
> 
> This also solves the following smatch warnings:
> service_callback() warn: argument 7 to %lx specifier is cast from pointer
> service_callback() warn: argument 11 to %lx specifier is cast from pointer
> service_callback() warn: argument 12 to %lx specifier is cast from pointer
> service_callback() warn: argument 13 to %lx specifier is cast from pointer
> vchiq_release() warn: argument 7 to %lx specifier is cast from pointer
> 
> Changes in v2:
> - Built/Rebased on top of:
>   [PATCH v2 0/5] staging: vc04_services: Drop custom logging
> 
> Umang Jain (2):
>   staging: vc04_services: Use %p to log pointer address
>   staging: vc04_services: Use %p to log pointer address

You have 2 different patches that do different things, yet have the
identical subject lines.  That needs to be fixed up before I can take
them.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-04 12:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 20:20 [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Umang Jain
2023-11-28 20:20 ` [PATCH v2 1/2] staging: vc04_services: Use %p to log pointer address Umang Jain
2023-12-04  7:07   ` Greg Kroah-Hartman
2023-11-28 20:20 ` [PATCH v2 2/2] " Umang Jain
2023-12-04  7:08 ` [PATCH v2 0/2] staging: vc04_services: Use %p to log pointer Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).