panic: declare as printf-style-checked

. and related fixes

Change-Id: I5131ac57dc53d8aec8d421a34c5ceea383404d7a
This commit is contained in:
Ben Gras 2013-02-02 00:55:35 +00:00
parent 5507a12d7c
commit 2d2a1a077d
22 changed files with 30 additions and 29 deletions

View file

@ -2087,7 +2087,7 @@ static void ahci_init(int devind)
* the actual total number of ports to the size of the exposed area.
*/
if (size < AHCI_MEM_BASE_SIZE + AHCI_MEM_PORT_SIZE)
panic("HBA memory size too small: %lu", size);
panic("HBA memory size too small: %u", size);
size = MIN(size, AHCI_MEM_BASE_SIZE + AHCI_MEM_PORT_SIZE * NR_PORTS);

View file

@ -1536,7 +1536,7 @@ static int setup_dma(
if (n > size)
n= size;
if (n == 0 || (n & 1))
panic("bad size in iov: %d", iov[i].iov_size);
panic("bad size in iov: 0x%lx", iov[i].iov_size);
if(proc_nr != SELF) {
r= sys_umap(proc_nr, VM_GRANT, iov[i].iov_addr, n,
&user_phys);
@ -1609,7 +1609,7 @@ static int setup_dma(
panic("Bus master IDE active");
if (prdt_phys & 3)
panic("prdt not aligned: %d", prdt_phys);
panic("prdt not aligned: 0x%lx", prdt_phys);
r= sys_outl(wn->base_dma + DMA_PRDTP, prdt_phys);
if (r != 0) panic("setup_dma: sys_outl failed: %d", r);

View file

@ -273,7 +273,7 @@ static void pio_user2nic(dpeth_t *dep, int pageno, int pktsize)
if (inb_reg0(dep, DP_ISR) & ISR_RDC) break;
}
if (ix == 100) {
panic(RdmaErrMsg);
panic("%s", RdmaErrMsg);
}
return;
}

View file

@ -48,7 +48,8 @@ int fkey_ctl(int req, int *fkeys, int *sfkeys);
int printf(const char *fmt, ...);
void kputc(int c);
__dead void panic(const char *fmt, ...);
__dead void panic(const char *fmt, ...)
__attribute__((__format__(__printf__,1,2)));
int getuptime(clock_t *ticks, clock_t *realtime, time_t *boottime);
int getticks(clock_t *ticks);
int tickdelay(clock_t ticks);

View file

@ -289,7 +289,7 @@ vir_bytes bytes; /* # of bytes to be copied */
phys = 0;
} else {
if(phys == 0)
panic("vm_lookup returned phys: %d", phys);
panic("vm_lookup returned phys: 0x%lx", phys);
}
if(phys == 0) {

View file

@ -15,7 +15,7 @@ void ddekit_panic(char *fmt, ...)
va_start(va,fmt);
r = vprintf(fmt, va);
va_end(va);
panic("","",0);
panic("panicced");
while(1)
;

View file

@ -128,7 +128,7 @@ int devman_add_device(struct devman_dev *dev)
}
if (msg.DEVMAN_RESULT != 0) {
panic("devman_add_device: could add device: %d",
panic("devman_add_device: could add device: %ld",
msg.DEVMAN_RESULT);
}
@ -168,7 +168,7 @@ int devman_del_device(struct devman_dev *dev)
}
if (msg.DEVMAN_RESULT != 0) {
panic("devman_del_device: could delete device: %d",
panic("devman_del_device: could delete device: %ld",
msg.DEVMAN_RESULT);
}

View file

@ -11,7 +11,7 @@
#include "local.h"
#define CHECKOUTOFMEM(ptr) if(ptr == NULL) \
panic("Out of memory! (%s, line %d)" \
panic("Out of memory! (%s, line %d)", \
__FILE__, __LINE__)

View file

@ -472,7 +472,7 @@ int block_type; /* INODE_BLOCK, DIRECTORY_BLOCK, or whatever */
printf("libminixfs: ENOSYS, disabling VM calls\n");
vmcache = 0;
} else {
panic("libminixfs: setblock of 0x%lx dev 0x%x off "
panic("libminixfs: setblock of %p dev 0x%x off "
"0x%llx failed\n", bp->data, dev, dev_off);
}
}

View file

@ -17,11 +17,11 @@ int vm_cachecall(message *m, int call, void *addr, u32_t dev, u64_t dev_offset,
blocksize, PAGE_SIZE);
if(ino_offset % PAGE_SIZE)
panic("inode offset %d should be a multiple of pagesize %d\n",
panic("inode offset %lld should be a multiple of pagesize %d\n",
ino_offset, PAGE_SIZE);
if(dev_offset % PAGE_SIZE)
panic("dev offset offset %d should be a multiple of pagesize %d\n",
panic("dev offset offset %lld should be a multiple of pagesize %d\n",
dev_offset, PAGE_SIZE);
memset(m, 0, sizeof(*m));

View file

@ -59,7 +59,7 @@ int usb_send_urb(struct usb_urb* urb)
}
if (msg.USB_RESULT != 0) {
panic("usb_send_urb: hcd could not enqueue URB: %d", msg.USB_RESULT);
panic("usb_send_urb: hcd could not enqueue URB: %ld", msg.USB_RESULT);
}
/* everything ok, add urb to pending_urbs */
@ -145,7 +145,7 @@ int usb_init(char *name)
}
if (msg.USB_RESULT != 0 ) {
panic("usb_init: init failed: %d", msg.USB_RESULT);
panic("usb_init: init failed: %ld", msg.USB_RESULT);
}
return 0;

View file

@ -498,7 +498,7 @@ clear_indirect_table(struct virtio_device *dev, struct vring_desc *vd)
}
if (i >= dev->num_indirect)
panic("%s: Could not clear indirect descriptor table ");
panic("Could not clear indirect descriptor table ");
}
@ -538,7 +538,7 @@ set_indirect_descriptors(struct virtio_device *dev, struct virtio_queue *q,
/* Sanity check */
if (i >= dev->num_indirect)
panic("%s: No indirect descriptor tables left");
panic("No indirect descriptor tables left");
/* For indirect descriptor tables, only a single descriptor from
* the main ring is used.

View file

@ -115,7 +115,7 @@ static int get_work(void)
int r;
if ((r = sef_receive(ANY, &fs_m_in)) != OK)
panic(__FILE__, "receive failed", r);
panic("receive failed: %d", r);
return fs_m_in.m_type;
}
@ -135,7 +135,7 @@ static void send_reply(int err, int transid)
}
if ((r = send(fs_m_in.m_source, &fs_m_out)) != OK)
panic(__FILE__, "unable to send reply", r);
panic("unable to send reply: %d", r);
}
/*===========================================================================*

View file

@ -316,7 +316,7 @@ void free_block(struct super_block *sp, bit_t bit_returned)
bp = get_block(sp->s_dev, gd->block_bitmap, NORMAL);
if (unsetbit(b_bitmap(bp), bit))
panic("Tried to free unused block", bit_returned);
panic("Tried to free unused block %d", bit_returned);
lmfs_markdirty(bp);
put_block(bp, MAP_BLOCK);

View file

@ -229,7 +229,7 @@ static void free_inode_bit(struct super_block *sp, bit_t bit_returned,
bp = get_block(sp->s_dev, gd->inode_bitmap, NORMAL);
if (unsetbit(b_bitmap(bp), bit))
panic("Tried to free unused inode", bit_returned);
panic("Tried to free unused inode %d", bit_returned);
lmfs_markdirty(bp);
put_block(bp, MAP_BLOCK);

View file

@ -234,7 +234,7 @@ void put_inode(
return; /* checking here is easier than in caller */
if (rip->i_count < 1)
panic("put_inode: i_count already below 1", rip->i_count);
panic("put_inode: i_count already below 1: %d", rip->i_count);
if (--rip->i_count == 0) { /* i_count == 0 means no one is using it now */
if (rip->i_links_count == NO_LINK) {

View file

@ -718,7 +718,7 @@ off_t len;
panic("zeroblock_range: no block");
offset = pos % rip->i_sp->s_block_size;
if (offset + len > rip->i_sp->s_block_size)
panic("zeroblock_range: len too long", len);
panic("zeroblock_range: len too long: %d", len);
memset(b_data(bp) + offset, 0, len);
lmfs_markdirty(bp);
put_block(bp, FULL_DATA_BLOCK);

View file

@ -171,7 +171,7 @@ int fs_mkdir()
/* It was not possible to enter . or .. probably disk was full -
* links counts haven't been touched. */
if (search_dir(ldirp, lastc, NULL, DELETE, IGN_PERM, 0) != OK)
panic("Dir disappeared ", rip->i_num);
panic("Dir disappeared: %d ", rip->i_num);
rip->i_links_count--; /* undo the increment done in new_node() */
}
rip->i_dirt = IN_DIRTY; /* either way, i_links_count has changed */

View file

@ -42,7 +42,7 @@ struct super_block *get_super(
if (dev == NO_DEV)
panic("request for super_block of NO_DEV");
if (superblock->s_dev != dev)
panic("wrong superblock", (int) dev);
panic("wrong superblock: 0x%x", (int) dev);
return(superblock);
}

View file

@ -441,7 +441,7 @@ int lookup_hook(struct inode *parent, char *name,
* Alternative: pull in only PM's table?
*/
if ((r = getticks(&now)) != OK)
panic(__FILE__, "unable to get uptime", r);
panic("unable to get uptime: %d", r);
if (last_update != now) {
update_tables();

View file

@ -673,7 +673,7 @@ struct filp *f;
f->filp_mode = FILP_CLOSED;
f->filp_count = 0;
} else if (f->filp_count < 0) {
panic("VFS: invalid filp count: %d ino %d/%d", f->filp_count,
panic("VFS: invalid filp count: %d ino %d/%u", f->filp_count,
vp->v_dev, vp->v_inode_nr);
} else {
unlock_vnode(f->filp_vno);

View file

@ -1147,9 +1147,9 @@ void pt_init(void)
kern_mappings[index].flags |= ARCH_VM_PTE_RO;
#endif
if(addr % VM_PAGE_SIZE)
panic("VM: addr unaligned: %d", addr);
panic("VM: addr unaligned: %lu", addr);
if(len % VM_PAGE_SIZE)
panic("VM: len unaligned: %d", len);
panic("VM: len unaligned: %lu", len);
vir = offset;
if(sys_vmctl_reply_mapping(index, vir) != OK)
panic("VM: reply failed");