lkml.org 
[lkml]   [2021]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] staging: vchip_arm: Fix misuse of %x
We should restrict kernel pointer leakage issue by using kptr_restrict. 
Therefore kernel pointers should be specified by %pK rather than %lx.

Thanks.

Guo

----- Original Message -----
From: "Greg KH" <gregkh@linuxfoundation.org>
To: "Guo Zhi" <qtxuning1999@sjtu.edu.cn>
Cc: nsaenz@kernel.org, peterz@infradead.org, maz@kernel.org, bsegall@google.com, rdunlap@infradead.org, airlied@redhat.com, "kan liang" <kan.liang@linux.intel.com>, odin@uged.al, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, "linux-kernel" <linux-kernel@vger.kernel.org>
Sent: Thursday, September 23, 2021 1:19:34 PM
Subject: Re: [PATCH] staging: vchip_arm: Fix misuse of %x

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
>
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
> .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
> 1 file changed, 4 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 b5aac862a29..408e5fe710b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> return VCHIQ_SUCCESS;
>
> vchiq_log_trace(vchiq_arm_log_level,
> - "%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
> - __func__, (unsigned long)user_service,
> + "%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
> + __func__, user_service,
> service->localport, user_service->userdata,
> - reason, (unsigned long)header,
> - (unsigned long)instance, (unsigned long)bulk_userdata);
> + reason, header,
> + instance, bulk_userdata);

Why print this out at all? What uses this? Can it just be deleted?

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-09-23 14:58    [W:0.034 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site