]> granicus.if.org Git - strace/blobdiff - loop.c
Introduce generic STRINGIFY and STRINGIFY_VAL macros
[strace] / loop.c
diff --git a/loop.c b/loop.c
index e43fcaad84fabc7528c2a45d5e0671783c4489a9..df12520145d76a6189174c2e18fc4964cbd11328 100644 (file)
--- a/loop.c
+++ b/loop.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012 The Chromium OS Authors.
+ * Copyright (c) 2012-2017 The strace developers.
  * Written by Mike Frysinger <vapier@gentoo.org>.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -64,7 +65,12 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr)
                tprints(", lo_encrypt_type=");
                printxval(loop_crypt_type_options, info.lo_encrypt_type,
                        "LO_CRYPT_???");
-               tprintf(", lo_encrypt_key_size=%d", info.lo_encrypt_key_size);
+               /*
+                * It is converted to unsigned before use in kernel, see
+                * loop_info64_from_old in drivers/block/loop.c
+                */
+               tprintf(", lo_encrypt_key_size=%" PRIu32,
+                       (uint32_t) info.lo_encrypt_key_size);
        }
 
        tprints(", lo_flags=");
@@ -77,7 +83,8 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr)
        if (!abbrev(tcp) || info.lo_encrypt_type != LO_CRYPT_NONE) {
                tprints(", lo_encrypt_key=");
                print_quoted_string((void *) info.lo_encrypt_key,
-                                   LO_KEY_SIZE, 0);
+                                   MIN((uint32_t) info.lo_encrypt_key_size,
+                                   LO_KEY_SIZE), 0);
        }
 
        if (!abbrev(tcp))
@@ -138,7 +145,8 @@ decode_loop_info64(struct tcb *const tcp, const kernel_ulong_t addr)
                                    LO_NAME_SIZE, QUOTE_0_TERMINATED);
                tprints(", lo_encrypt_key=");
                print_quoted_string((void *) info64.lo_encrypt_key,
-                                   LO_KEY_SIZE, 0);
+                                   MIN(info64.lo_encrypt_key_size,
+                                   LO_KEY_SIZE), 0);
        }
 
        if (!abbrev(tcp))
@@ -153,9 +161,6 @@ MPERS_PRINTER_DECL(int, loop_ioctl,
                   struct tcb *tcp, const unsigned int code,
                   const kernel_ulong_t arg)
 {
-       if (!verbose(tcp))
-               return RVAL_DECODED;
-
        switch (code) {
        case LOOP_GET_STATUS:
                if (entering(tcp))