Avoid printing raw addresses in driver logs by using %p for remote
buffer addresses. This reduces the risk of information leaks and
conforms to kernel logging guidelines. Remove tabs in dev_*
messages.
Fixes: 2419e55e532d ("misc: fastrpc: add mmap/unmap support")
Cc: stable@kernel.org
Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
---
drivers/misc/fastrpc.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index ee652ef01534..408fe47e9db7 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1830,13 +1830,13 @@ static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, struct fastrpc_buf *
err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc,
&args[0]);
if (!err) {
- dev_dbg(dev, "unmmap\tpt 0x%09lx OK\n", buf->raddr);
+ dev_dbg(dev, "unmap OK: raddr=%p\n", (void *)(unsigned long)buf->raddr);
spin_lock(&fl->lock);
list_del(&buf->node);
spin_unlock(&fl->lock);
fastrpc_buf_free(buf);
} else {
- dev_err(dev, "unmmap\tpt 0x%09lx ERROR\n", buf->raddr);
+ dev_err(dev, "unmap error: raddr=%p\n", (void *)(unsigned long)buf->raddr);
}
return err;
@@ -1861,8 +1861,8 @@ static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp)
spin_unlock(&fl->lock);
if (!buf) {
- dev_err(dev, "mmap\t\tpt 0x%09llx [len 0x%08llx] not in list\n",
- req.vaddrout, req.size);
+ dev_err(dev, "buffer not found: addr=%p [len=0x%08llx]\n",
+ (void *)(unsigned long)req.vaddrout, req.size);
return -EINVAL;
}
@@ -1959,8 +1959,8 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
goto err_assign;
}
- dev_dbg(dev, "mmap\t\tpt 0x%09lx OK [len 0x%08llx]\n",
- buf->raddr, buf->size);
+ dev_dbg(dev, "mmap OK: raddr=%p [len=0x%08llx]\n",
+ (void *)(unsigned long)buf->raddr, buf->size);
return 0;
@@ -2006,7 +2006,8 @@ static int fastrpc_req_mem_unmap_impl(struct fastrpc_user *fl, struct fastrpc_me
err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc,
&args[0]);
if (err) {
- dev_err(dev, "unmmap\tpt fd = %d, 0x%09llx error\n", map->fd, map->raddr);
+ dev_err(dev, "unmap error: fd=%d, raddr=%p\n",
+ map->fd, (void *)(unsigned long)map->raddr);
return err;
}
fastrpc_map_put(map);
@@ -2074,8 +2075,8 @@ static int fastrpc_req_mem_map(struct fastrpc_user *fl, char __user *argp)
sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_MEM_MAP, 3, 1);
err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, &args[0]);
if (err) {
- dev_err(dev, "mem mmap error, fd %d, vaddr %llx, size %lld\n",
- req.fd, req.vaddrin, map->len);
+ dev_err(dev, "mem mmap error: fd=%d, vaddrin=%p, size=%lld\n",
+ req.fd, (void *)(unsigned long)req.vaddrin, map->len);
goto err_invoke;
}
--
2.34.1
On 12/30/25 12:02 PM, Ekansh Gupta wrote:
> Avoid printing raw addresses in driver logs by using %p for remote
> buffer addresses. This reduces the risk of information leaks and
> conforms to kernel logging guidelines. Remove tabs in dev_*
> messages.
>
> Fixes: 2419e55e532d ("misc: fastrpc: add mmap/unmap support")
> Cc: stable@kernel.org
> Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
> ---
> drivers/misc/fastrpc.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index ee652ef01534..408fe47e9db7 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1830,13 +1830,13 @@ static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, struct fastrpc_buf *
> err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc,
> &args[0]);
> if (!err) {
> - dev_dbg(dev, "unmmap\tpt 0x%09lx OK\n", buf->raddr);
> + dev_dbg(dev, "unmap OK: raddr=%p\n", (void *)(unsigned long)buf->raddr);
Would it be easier if we did away with the uintptr_t, since the protocol
seems to assume all addresses are u64s anyway?
Konrad
On Tue, Dec 30, 2025 at 02:23:55PM +0100, Konrad Dybcio wrote:
> On 12/30/25 12:02 PM, Ekansh Gupta wrote:
> > Avoid printing raw addresses in driver logs by using %p for remote
> > buffer addresses. This reduces the risk of information leaks and
> > conforms to kernel logging guidelines. Remove tabs in dev_*
> > messages.
> >
> > Fixes: 2419e55e532d ("misc: fastrpc: add mmap/unmap support")
> > Cc: stable@kernel.org
> > Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
> > ---
> > drivers/misc/fastrpc.c | 19 ++++++++++---------
> > 1 file changed, 10 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> > index ee652ef01534..408fe47e9db7 100644
> > --- a/drivers/misc/fastrpc.c
> > +++ b/drivers/misc/fastrpc.c
> > @@ -1830,13 +1830,13 @@ static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, struct fastrpc_buf *
> > err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc,
> > &args[0]);
> > if (!err) {
> > - dev_dbg(dev, "unmmap\tpt 0x%09lx OK\n", buf->raddr);
> > + dev_dbg(dev, "unmap OK: raddr=%p\n", (void *)(unsigned long)buf->raddr);
>
> Would it be easier if we did away with the uintptr_t, since the protocol
> seems to assume all addresses are u64s anyway?
Why is a pointer being printed at all? That shouldn't be needed and is,
as always, a potential information leak.
thanks,
greg k-h
© 2016 - 2026 Red Hat, Inc.