* [PATCH v2] nvdimm/btt: fix sequence endian in btt_log_read error print
@ 2026-06-24 15:06 Ben Dooks
2026-07-14 23:22 ` Alison Schofield
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2026-06-24 15:06 UTC (permalink / raw)
To: Vishal Verma, Dan Williams, Dave Jiang, Alison Schofield,
Ira Weiny, nvdimm, linux-kernel
Cc: Ben Dooks
The error reporting in btt_log_read() prints sequence numbers out
from the log which are stored in little endian without any endian
conversion. Make sure these are passed throuhg endian convesion
before going to the kernel console so the user sees the correct
sequence number and to avoid any warnings from sparse due to
endian conversion.
Fix the following (prototype) sparse warnings:
drivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 5 (different base types)
drivers/nvdimm/btt.c:342:17: expected int
drivers/nvdimm/btt.c:342:17: got restricted __le32 [usertype] seq
drivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 6 (different base types)
drivers/nvdimm/btt.c:342:17: expected int
drivers/nvdimm/btt.c:342:17: got restricted __le32 [usertype] seq
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
v2: reworded commnit messae
---
drivers/nvdimm/btt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 7e1112960d7f..e9d548442884 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -341,8 +341,9 @@ static int btt_log_read(struct arena_info *arena, u32 lane,
if (old_ent < 0 || old_ent > 1) {
dev_err(to_dev(arena),
"log corruption (%d): lane %d seq [%d, %d]\n",
- old_ent, lane, log.ent[arena->log_index[0]].seq,
- log.ent[arena->log_index[1]].seq);
+ old_ent, lane,
+ le32_to_cpu(log.ent[arena->log_index[0]].seq),
+ le32_to_cpu(log.ent[arena->log_index[1]].seq));
/* TODO set error state? */
return -EIO;
}
--
2.37.2.352.g3c44437643
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] nvdimm/btt: fix sequence endian in btt_log_read error print
2026-06-24 15:06 [PATCH v2] nvdimm/btt: fix sequence endian in btt_log_read error print Ben Dooks
@ 2026-07-14 23:22 ` Alison Schofield
0 siblings, 0 replies; 2+ messages in thread
From: Alison Schofield @ 2026-07-14 23:22 UTC (permalink / raw)
To: Ben Dooks
Cc: Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, nvdimm, linux-kernel
On Wed, Jun 24, 2026 at 04:06:02PM +0100, Ben Dooks wrote:
> The error reporting in btt_log_read() prints sequence numbers out
> from the log which are stored in little endian without any endian
> conversion. Make sure these are passed throuhg endian convesion
> before going to the kernel console so the user sees the correct
> sequence number and to avoid any warnings from sparse due to
> endian conversion.
>
> Fix the following (prototype) sparse warnings:
> drivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 5 (different base types)
> drivers/nvdimm/btt.c:342:17: expected int
> drivers/nvdimm/btt.c:342:17: got restricted __le32 [usertype] seq
> drivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 6 (different base types)
> drivers/nvdimm/btt.c:342:17: expected int
> drivers/nvdimm/btt.c:342:17: got restricted __le32 [usertype] seq
>
Hi Ben,
I'll wait on a v3 of this one that addresses the Sashiko review
feedback. Thanks!
-- Alison
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> v2: reworded commnit messae
> ---
> drivers/nvdimm/btt.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> index 7e1112960d7f..e9d548442884 100644
> --- a/drivers/nvdimm/btt.c
> +++ b/drivers/nvdimm/btt.c
> @@ -341,8 +341,9 @@ static int btt_log_read(struct arena_info *arena, u32 lane,
> if (old_ent < 0 || old_ent > 1) {
> dev_err(to_dev(arena),
> "log corruption (%d): lane %d seq [%d, %d]\n",
> - old_ent, lane, log.ent[arena->log_index[0]].seq,
> - log.ent[arena->log_index[1]].seq);
> + old_ent, lane,
> + le32_to_cpu(log.ent[arena->log_index[0]].seq),
> + le32_to_cpu(log.ent[arena->log_index[1]].seq));
> /* TODO set error state? */
> return -EIO;
> }
> --
> 2.37.2.352.g3c44437643
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-14 23:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24 15:06 [PATCH v2] nvdimm/btt: fix sequence endian in btt_log_read error print Ben Dooks
2026-07-14 23:22 ` Alison Schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®