isobusfs: fix printf format specifiers in log messages

Several log messages used format specifiers which did not match the
types of the provided arguments (e.g. %d or %i for size_t/ssize_t,
%ld for int64_t/time_t and size_t for the '.*' precision). On 64 bit
hosts (and for int64_t/time_t on 32 bit hosts) this leads to wrong
output or undefined behaviour when the log level is enabled.

Additionally the seek response position was compared to the requested
offset without le32toh() conversion which fails on big endian hosts.

Fix the format specifiers and add the missing le32toh() conversion.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
Oliver Hartkopp
2026-10-14 19:25:06 +02:00
parent 0f55228325
commit 8355b57133
8 changed files with 16 additions and 15 deletions
+4 -4
View File
@@ -547,9 +547,9 @@ isobusfs_cli_ls_handle_seek_dir_sent(struct isobusfs_priv *priv,
if (isobusfs_cli_int_is_error(priv, 0, res->error_code, res->tan))
goto error;
if (res->position != ctx->offset) {
pr_int("Failed to seek to position %zu, got %zu\n",
ctx->offset, res->position);
if (le32toh(res->position) != ctx->offset) {
pr_int("Failed to seek to position %zu, got %u\n",
ctx->offset, le32toh(res->position));
goto error;
}
@@ -868,7 +868,7 @@ static void isobusfs_cli_process_ls_command(struct isobusfs_priv *priv,
ctx->handle, NULL, NULL);
}
pr_int("Entries found: %i\n", ctx->entry_count);
pr_int("Entries found: %zu\n", ctx->entry_count);
priv->int_busy = false;
isobusfs_cli_ls_free_ctx(ctx);
isobusfs_cli_promt(priv);