linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeffrey Hugo <jhugo@codeaurora.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	gregkh@linuxfoundation.org
Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bus: mhi: core: debugfs: Use correct format specifiers for addresses
Date: Fri, 25 Sep 2020 12:01:54 -0600	[thread overview]
Message-ID: <c63ae2c3-43ae-6a94-cf27-efb6cc038f83@codeaurora.org> (raw)
In-Reply-To: <20200925171608.30881-1-manivannan.sadhasivam@linaro.org>

On 9/25/2020 11:16 AM, Manivannan Sadhasivam wrote:
> For exposing the addresses of read/write pointers and doorbell register,
> let's use the correct format specifiers. This fixes the following issues
> generated using W=1 build in ARM32 and reported by Kbuild bot:
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/bus/mhi/core/debugfs.c:75:7: warning: format specifies type 'unsigned long long' but the argument has type 'dma_addr_t' (aka 'unsigned int') [-Wformat]
>                                mhi_event->db_cfg.db_val);
>                                ^~~~~~~~~~~~~~~~~~~~~~~~
>     drivers/bus/mhi/core/debugfs.c:123:7: warning: format specifies type 'unsigned long long' but the argument has type 'dma_addr_t' (aka 'unsigned int') [-Wformat]
>                                mhi_chan->db_cfg.db_val);
>                                ^~~~~~~~~~~~~~~~~~~~~~~
>     2 warnings generated.
> 
> drivers/bus/mhi/core/debugfs.c: In function ‘mhi_debugfs_events_show’:
> drivers/bus/mhi/core/debugfs.c:74:51: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>     seq_printf(m, " local rp: 0x%llx db: 0x%pad\n", (u64)ring->rp,
>                                                     ^
> drivers/bus/mhi/core/debugfs.c: In function ‘mhi_debugfs_channels_show’:
> drivers/bus/mhi/core/debugfs.c:122:7: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>         (u64)ring->rp, (u64)ring->wp,
>         ^
> drivers/bus/mhi/core/debugfs.c:122:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>         (u64)ring->rp, (u64)ring->wp,
>                        ^
> drivers/bus/mhi/core/debugfs.c:121:62: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘dma_addr_t {aka unsigned int}’ [-Wformat=]
>     seq_printf(m, " local rp: 0x%llx local wp: 0x%llx db: 0x%llx\n",
>                                                             ~~~^
>                                                             %x
> drivers/bus/mhi/core/debugfs.c:123:7:
>         mhi_chan->db_cfg.db_val);
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
> 
> Greg: This fixes the issue seen while testing the char-misc/char-misc-testing
> branch.
> 
>   drivers/bus/mhi/core/debugfs.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/debugfs.c b/drivers/bus/mhi/core/debugfs.c
> index 53d05a8e168d..2536ff92b76f 100644
> --- a/drivers/bus/mhi/core/debugfs.c
> +++ b/drivers/bus/mhi/core/debugfs.c
> @@ -71,8 +71,8 @@ static int mhi_debugfs_events_show(struct seq_file *m, void *d)
>   		seq_printf(m, " rp: 0x%llx wp: 0x%llx", er_ctxt->rp,
>   			   er_ctxt->wp);
>   
> -		seq_printf(m, " local rp: 0x%llx db: 0x%llx\n", (u64)ring->rp,
> -			   mhi_event->db_cfg.db_val);
> +		seq_printf(m, " local rp: 0x%px db: 0x%pad\n", ring->rp,
> +			   &mhi_event->db_cfg.db_val);
>   	}
>   
>   	return 0;
> @@ -118,9 +118,9 @@ static int mhi_debugfs_channels_show(struct seq_file *m, void *d)
>   		seq_printf(m, " base: 0x%llx len: 0x%llx wp: 0x%llx",
>   			   chan_ctxt->rbase, chan_ctxt->rlen, chan_ctxt->wp);
>   
> -		seq_printf(m, " local rp: 0x%llx local wp: 0x%llx db: 0x%llx\n",
> -			   (u64)ring->rp, (u64)ring->wp,
> -			   mhi_chan->db_cfg.db_val);
> +		seq_printf(m, " local rp: 0x%px local wp: 0x%px db: 0x%pad\n",
> +			   ring->rp, ring->wp,
> +			   &mhi_chan->db_cfg.db_val);
>   	}
>   
>   	return 0;
> 

Documentation/printk-formats.txt seems to point out that %px is 
"insecure" and thus perhaps not preferred.  Are we assuming that debugfs 
is only accessible by root, and thus the %px usage here is effectively 
the same as %pK?

-- 
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2020-09-25 18:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 17:16 [PATCH] bus: mhi: core: debugfs: Use correct format specifiers for addresses Manivannan Sadhasivam
2020-09-25 18:01 ` Jeffrey Hugo [this message]
2020-09-26  5:27   ` Manivannan Sadhasivam
2020-09-26  5:39     ` Greg KH
2020-09-26  7:16       ` Manivannan Sadhasivam
2020-09-26 12:46         ` Greg KH
2020-09-26 14:13           ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c63ae2c3-43ae-6a94-cf27-efb6cc038f83@codeaurora.org \
    --to=jhugo@codeaurora.org \
    --cc=bbhatt@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hemantk@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).