Fix usage of zed_log_msg() and zfs_panic_recover()

Coverity complained about the format specifiers not matching variables.
In one case, the variable is a constant, so we fix it. In another, we
were missing an argument (about which coverity also complained).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #13888
This commit is contained in:
Richard Yao 2022-09-19 20:32:18 -04:00 committed by GitHub
parent 891ac937be
commit f272960d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View File

@ -372,7 +372,7 @@ zed_log_fault(nvlist_t *nvl, const char *uuid, const char *code)
if (code != NULL) if (code != NULL)
zed_log_msg(LOG_INFO, "\t%s: %s", FM_SUSPECT_DIAG_CODE, code); zed_log_msg(LOG_INFO, "\t%s: %s", FM_SUSPECT_DIAG_CODE, code);
if (nvlist_lookup_uint8(nvl, FM_FAULT_CERTAINTY, &byte) == 0) if (nvlist_lookup_uint8(nvl, FM_FAULT_CERTAINTY, &byte) == 0)
zed_log_msg(LOG_INFO, "\t%s: %llu", FM_FAULT_CERTAINTY, byte); zed_log_msg(LOG_INFO, "\t%s: %hhu", FM_FAULT_CERTAINTY, byte);
if (nvlist_lookup_nvlist(nvl, FM_FAULT_RESOURCE, &rsrc) == 0) { if (nvlist_lookup_nvlist(nvl, FM_FAULT_RESOURCE, &rsrc) == 0) {
if (nvlist_lookup_string(rsrc, FM_FMRI_SCHEME, &strval) == 0) if (nvlist_lookup_string(rsrc, FM_FMRI_SCHEME, &strval) == 0)
zed_log_msg(LOG_INFO, "\t%s: %s", FM_FMRI_SCHEME, zed_log_msg(LOG_INFO, "\t%s: %s", FM_FMRI_SCHEME,

View File

@ -364,7 +364,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
(vs->vs_state != VDEV_STATE_FAULTED) && (vs->vs_state != VDEV_STATE_FAULTED) &&
(vs->vs_state != VDEV_STATE_CANT_OPEN)) { (vs->vs_state != VDEV_STATE_CANT_OPEN)) {
zed_log_msg(LOG_INFO, " not autoreplacing since disk isn't in " zed_log_msg(LOG_INFO, " not autoreplacing since disk isn't in "
"a bad state (currently %d)", vs->vs_state); "a bad state (currently %llu)", vs->vs_state);
return; return;
} }

View File

@ -657,7 +657,7 @@ zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[])
} else if (n != len) { } else if (n != len) {
errno = EIO; errno = EIO;
zed_log_msg(LOG_WARNING, zed_log_msg(LOG_WARNING,
"Failed to read state file \"%s\": Read %d of %d bytes", "Failed to read state file \"%s\": Read %zd of %zd bytes",
zcp->state_file, n, len); zcp->state_file, n, len);
return (-1); return (-1);
} }
@ -706,7 +706,7 @@ zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[])
if (n != len) { if (n != len) {
errno = EIO; errno = EIO;
zed_log_msg(LOG_WARNING, zed_log_msg(LOG_WARNING,
"Failed to write state file \"%s\": Wrote %d of %d bytes", "Failed to write state file \"%s\": Wrote %zd of %zd bytes",
zcp->state_file, n, len); zcp->state_file, n, len);
return (-1); return (-1);
} }

View File

@ -49,7 +49,7 @@ struct udev_monitor *g_mon;
#define DEV_BYID_PATH "/dev/disk/by-id/" #define DEV_BYID_PATH "/dev/disk/by-id/"
/* 64MB is minimum usable disk for ZFS */ /* 64MB is minimum usable disk for ZFS */
#define MINIMUM_SECTORS 131072 #define MINIMUM_SECTORS 131072ULL
/* /*

View File

@ -263,7 +263,7 @@ _reap_children(void *arg)
zed_log_msg(LOG_INFO, zed_log_msg(LOG_INFO,
"Finished \"%s\" eid=%llu pid=%d " "Finished \"%s\" eid=%llu pid=%d "
"time=%llu.%06us status=0x%X", "time=%llu.%06us status=0x%X",
node.name, node.eid, node.name, node.eid, pid,
(unsigned long long) usage.ru_utime.tv_sec, (unsigned long long) usage.ru_utime.tv_sec,
(unsigned int) usage.ru_utime.tv_usec, (unsigned int) usage.ru_utime.tv_usec,
(unsigned int) status); (unsigned int) status);

View File

@ -347,7 +347,7 @@ spa_checkpoint_discard_thread_sync(void *arg, dmu_tx_t *tx)
if (error != 0) { if (error != 0) {
zfs_panic_recover("zfs: error %lld was returned " zfs_panic_recover("zfs: error %lld was returned "
"while incrementally destroying the checkpoint " "while incrementally destroying the checkpoint "
"space map of vdev %u\n", "space map of vdev %llu\n",
(longlong_t)error, vd->vdev_id); (longlong_t)error, vd->vdev_id);
} }
ASSERT0(words_after); ASSERT0(words_after);