mbox series

[0/2] staging: vc04_services: Use %p to log pointer

Message ID 20231107165523.638555-1-umang.jain@ideasonboard.com
Headers show
Series staging: vc04_services: Use %p to log pointer | expand

Message

Umang Jain Nov. 7, 2023, 4:55 p.m. UTC
%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

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  | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Greg Kroah-Hartman Nov. 23, 2023, 1:14 p.m. UTC | #1
On Tue, Nov 07, 2023 at 11:55:21AM -0500, 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

Doesn't apply as I didn't take your other patch series.  resend it when
you have that one fixed up?

thanks,

greg k-h