From: Arnd Bergmann <arnd@kernel.org>
To: Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Desnes Nunes <desnesn@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] dma-debug: use %pap format string for phys_addr_t
Date: Wed, 29 Mar 2023 09:59:45 +0200 [thread overview]
Message-ID: <20230329075956.2376819-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
On 32-bit architectures with 64-bit physical addresses, the
debug print is broken:
kernel/dma/debug.c: In function 'dump_show':
kernel/dma/debug.c:568:87: error: format '%llx' expects argument of type 'long long unsigned int', but argument 11 has type 'phys_addr_t' {aka 'unsigned int'} [-Werror=format=]
568 | "%s %s %s idx %d P=%llx N=%lx D=%llx L=%llx cln=%llx %s %s\n",
| ~~~^
| |
| long long unsigned int
| %x
......
574 | cln, dir2name[entry->direction],
| ~~~
| |
| phys_addr_t {aka unsigned int}
Use the special %pap format modifier for printing physical addresses.
Fixes: bd89d69a529f ("dma-debug: add cacheline to user/kernel space dump messages")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
kernel/dma/debug.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 676142072d99..d8b233683a8c 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -534,11 +534,11 @@ void debug_dma_dump_mappings(struct device *dev)
if (!dev || dev == entry->dev) {
cln = to_cacheline_number(entry);
dev_info(entry->dev,
- "%s idx %d P=%llx N=%lx D=%llx L=%llx cln=%llx %s %s\n",
+ "%s idx %d P=%llx N=%lx D=%llx L=%llx cln=%pap %s %s\n",
type2name[entry->type], idx,
phys_addr(entry), entry->pfn,
entry->dev_addr, entry->size,
- cln, dir2name[entry->direction],
+ &cln, dir2name[entry->direction],
maperr2str[entry->map_err_type]);
}
}
@@ -565,13 +565,13 @@ static int dump_show(struct seq_file *seq, void *v)
list_for_each_entry(entry, &bucket->list, list) {
cln = to_cacheline_number(entry);
seq_printf(seq,
- "%s %s %s idx %d P=%llx N=%lx D=%llx L=%llx cln=%llx %s %s\n",
+ "%s %s %s idx %d P=%llx N=%lx D=%llx L=%llx cln=%pap %s %s\n",
dev_driver_string(entry->dev),
dev_name(entry->dev),
type2name[entry->type], idx,
phys_addr(entry), entry->pfn,
entry->dev_addr, entry->size,
- cln, dir2name[entry->direction],
+ &cln, dir2name[entry->direction],
maperr2str[entry->map_err_type]);
}
spin_unlock_irqrestore(&bucket->lock, flags);
--
2.39.2
reply other threads:[~2023-03-29 8:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230329075956.2376819-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--cc=desnesn@redhat.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
/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