From 89aac2b3a13c12edc057e517be17889ed45226dc Mon Sep 17 00:00:00 2001 From: alfred Date: Sun, 7 Jul 2013 21:39:37 +0000 Subject: [PATCH] Make kassert_printf use __printflike. Fix associated errors/warnings while I'm here. Requested by: avg --- sys/kern/subr_witness.c | 8 ++++++-- sys/kern/vfs_bio.c | 4 ++-- sys/net80211/ieee80211_output.c | 2 +- sys/sys/systm.h | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index bf28a88865f6..3b4d7a2fd776 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -1138,12 +1138,16 @@ witness_checkorder(struct lock_object *lock, int flags, const char *file, iclass = LOCK_CLASS(interlock); lock1 = find_instance(lock_list, interlock); if (lock1 == NULL) - kassert_panic("interlock (%s) %s not locked @ %s:%d", + kassert_panic( + "interlock (%s) %s not locked while locking" + " %s @ %s:%d", iclass->lc_name, interlock->lo_name, flags & LOP_EXCLUSIVE ? "exclusive" : "shared", fixup_filename(file), line); else if ((lock1->li_flags & LI_RECURSEMASK) != 0) - kassert_panic("interlock (%s) %s recursed @ %s:%d", + kassert_panic( + "interlock (%s) %s recursed while locking %s" + " @ %s:%d", iclass->lc_name, interlock->lo_name, flags & LOP_EXCLUSIVE ? "exclusive" : "shared", fixup_filename(file), line); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index f6d5a85bfe29..c5af3f585a2d 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4485,8 +4485,8 @@ bdata2bio(struct buf *bp, struct bio *bip) bip->bio_flags |= BIO_UNMAPPED; KASSERT(round_page(bip->bio_ma_offset + bip->bio_length) / PAGE_SIZE == bp->b_npages, - ("Buffer %p too short: %d %d %d", bp, bip->bio_ma_offset, - bip->bio_length, bip->bio_ma_n)); + ("Buffer %p too short: %d %lld %d", bp, bip->bio_ma_offset, + (long long)bip->bio_length, bip->bio_ma_n)); } else { bip->bio_data = bp->b_data; bip->bio_ma = NULL; diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 2fff3ae056c3..defebc9d85e4 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1022,7 +1022,7 @@ ieee80211_mbuf_adjust(struct ieee80211vap *vap, int hdrsize, return NULL; } KASSERT(needed_space <= MHLEN, - ("not enough room, need %u got %zu\n", needed_space, MHLEN)); + ("not enough room, need %u got %d\n", needed_space, MHLEN)); /* * Setup new mbuf to have leading space to prepend the * 802.11 header and any crypto header bits that are diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 078f3cdc60e3..4887d71f5675 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -74,7 +74,7 @@ extern int vm_guest; /* Running as virtual machine guest? */ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN }; #if defined(WITNESS) || defined(INVARIANTS) -void kassert_panic(const char *fmt, ...); +void kassert_panic(const char *fmt, ...) __printflike(1, 2); #endif #ifdef INVARIANTS /* The option is always available */