Skip to content

Commit a325df7

Browse files
authored
Merge pull request #246 from smartobjectoriented/240-warn-on-printk
add format(printf) attribute and fix warnings
2 parents e5eb10b + 7b518fe commit a325df7

26 files changed

Lines changed: 61 additions & 48 deletions

File tree

so3/apps/sample.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void *app_thread_main(void *args)
7777
while (threads != 4)
7878
;
7979

80-
printk("### Total = %lld\n", count);
80+
printk("### Total = %d\n", count);
8181

8282
while (1)
8383
;

so3/arch/arm64/domain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void __setup_dom_pgtable(struct domain *d, addr_t paddr_start, unsigned long map
107107
printk(" Map size (bytes) : 0x%lx\n", map_size);
108108

109109
printk(" Intermediate phys address : 0x%lx\n", memslot[slotID].ipa_addr);
110-
printk(" Stage-2 vttbr : (va) 0x%lx - (pa) 0x%lx\n", new_pt, __pa(new_pt));
110+
printk(" Stage-2 vttbr : (va) 0x%p - (pa) 0x%lx\n", new_pt, __pa(new_pt));
111111

112112
d->pagetable_vaddr = (addr_t) new_pt;
113113
d->pagetable_paddr = __pa(new_pt);

so3/arch/arm64/mmu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ void dump_pgtable(void *l0pgtable)
761761
for (i = 0; i < TTB_L0_ENTRIES; i++) {
762762
l0pte = __l0pgtable + i;
763763
if ((i != 0xe0) && *l0pte) {
764-
lprintk(" - L0 pte@%lx (idx %x) mapping %lx content: %lx\n", __l0pgtable + i, i, i << TTB_I0_SHIFT,
764+
lprintk(" - L0 pte@%p (idx %lx) mapping %lx content: %lx\n", __l0pgtable + i, i, i << TTB_I0_SHIFT,
765765
*l0pte);
766766
BUG_ON(pte_type(l0pte) != PTE_TYPE_TABLE);
767767

@@ -770,14 +770,14 @@ void dump_pgtable(void *l0pgtable)
770770
l1pte = ((u64 *) __va(*l0pte & TTB_L0_TABLE_ADDR_MASK)) + j;
771771
if (*l1pte) {
772772
if (pte_type(l1pte) == PTE_TYPE_TABLE) {
773-
lprintk(" (TABLE) L1 pte@%lx (idx %x) mapping %lx content: %lx\n", l1pte, j,
773+
lprintk(" (TABLE) L1 pte@%p (idx %lx) mapping %lx content: %lx\n", l1pte, j,
774774
(i << TTB_I0_SHIFT) + (j << TTB_I1_SHIFT), *l1pte);
775775

776776
for (k = 0; k < TTB_L2_ENTRIES; k++) {
777777
l2pte = ((u64 *) __va(*l1pte & TTB_L1_TABLE_ADDR_MASK)) + k;
778778
if (*l2pte) {
779779
if (pte_type(l2pte) == PTE_TYPE_TABLE) {
780-
lprintk(" (TABLE) L2 pte@%lx (idx %x) mapping %lx content: %lx\n",
780+
lprintk(" (TABLE) L2 pte@%p (idx %lx) mapping %lx content: %lx\n",
781781
l2pte, k,
782782
(i << TTB_I0_SHIFT) + (j << TTB_I1_SHIFT) +
783783
(k << TTB_I2_SHIFT),
@@ -788,7 +788,7 @@ void dump_pgtable(void *l0pgtable)
788788
TTB_L2_TABLE_ADDR_MASK)) +
789789
l;
790790
if (*l3pte)
791-
lprintk(" (PAGE) L3 pte@%lx (idx %x) mapping %lx content: %lx\n",
791+
lprintk(" (PAGE) L3 pte@%p (idx %lx) mapping %lx content: %lx\n",
792792
l3pte, l,
793793
(i << TTB_I0_SHIFT) +
794794
(j << TTB_I1_SHIFT) +
@@ -799,7 +799,7 @@ void dump_pgtable(void *l0pgtable)
799799
} else {
800800
/* Necessary of BLOCK type */
801801
BUG_ON(pte_type(l2pte) != PTE_TYPE_BLOCK);
802-
lprintk(" (PAGE) L2 pte@%lx (idx %x) mapping %lx content: %lx\n",
802+
lprintk(" (PAGE) L2 pte@%p (idx %lx) mapping %lx content: %lx\n",
803803
l2pte, k,
804804
(i << TTB_I0_SHIFT) + (j << TTB_I1_SHIFT) +
805805
(k << TTB_I2_SHIFT),
@@ -811,7 +811,7 @@ void dump_pgtable(void *l0pgtable)
811811
/* Necessary of BLOCK type */
812812
BUG_ON(pte_type(l1pte) != PTE_TYPE_BLOCK);
813813

814-
lprintk(" (PAGE) L1 pte@%lx (idx %x) mapping %lx content: %lx\n", l1pte, j,
814+
lprintk(" (PAGE) L1 pte@%p (idx %lx) mapping %lx content: %lx\n", l1pte, j,
815815
(i << TTB_I0_SHIFT) + (j << TTB_I1_SHIFT), *l1pte);
816816
}
817817
}

so3/arch/arm64/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void trap_handle(cpu_regs_t *regs)
183183
break;
184184

185185
case PSCI_0_2_FN64_CPU_ON:
186-
printk("Power on CPU #%d starting at %x...\n", regs->x1 & 3, regs->x2);
186+
printk("Power on CPU #%ld starting at %lx...\n", regs->x1 & 3, regs->x2);
187187

188188
cpu_entrypoint = regs->x2;
189189
smp_trigger_event(regs->x1 & 3);

so3/avz/include/avz/console.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
#define AVZ_CONSOLE_H
2121

2222
#include <stdarg.h>
23+
#include <compiler.h>
2324

2425
#include <avz/uapi/avz.h>
2526

2627
void init_console(void);
2728

2829
extern void (*__printch)(char c);
2930

30-
void lprintk(char *format, ...);
31+
void lprintk(char *format, ...) __attribute_printf(1, 2);
3132
void lprintk_buffer(void *buffer, uint32_t n);
3233
void lprintk_buffer_separator(void *buffer, uint32_t n, char separator);
3334

so3/avz/kernel/ME_build.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int construct_ME(struct domain *d)
5454
d->max_pages = ~0U;
5555

5656
d->avz_shared->nr_pages = memslot[slotID].size >> PAGE_SHIFT;
57-
printk("Max dom size %d\n", memslot[slotID].size);
57+
printk("Max dom size %ld\n", memslot[slotID].size);
5858

5959
printk("Domain length = %lu pages.\n", d->avz_shared->nr_pages);
6060

so3/avz/kernel/agency_build.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int construct_agency(struct domain *d)
5151
d->max_pages = ~0U;
5252

5353
printk("-> Agency base address from ITB: %lx\n", memslot[MEMSLOT_AGENCY].base_paddr);
54-
printk("-> Max dom size %d\n", memslot[MEMSLOT_AGENCY].size);
54+
printk("-> Max dom size %ld\n", memslot[MEMSLOT_AGENCY].size);
5555

5656
ASSERT(d);
5757

@@ -68,7 +68,7 @@ int construct_agency(struct domain *d)
6868
printk("AVZ Hypervisor vaddr: 0x%lx\n", CONFIG_KERNEL_VADDR);
6969
printk("Agency FDT device tree: 0x%lx (phys)\n", d->avz_shared->fdt_paddr);
7070

71-
printk("Shared AVZ page is located at: %lx\n", d->avz_shared);
71+
printk("Shared AVZ page is located at: %p\n", d->avz_shared);
7272

7373
initialize_hyp_dom_stack(d, pa_to_ipa(MEMSLOT_AGENCY, d->avz_shared->fdt_paddr), memslot[MEMSLOT_AGENCY].entry_addr);
7474

so3/avz/kernel/domain_utils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ void loadAgency(void)
245245
/* Get the RAM information of the board */
246246
early_memory_init(__fdt_addr);
247247

248-
lprintk(" AVZ DT at physical address : %lx\n", __fdt_addr);
249-
lprintk(" AVZ memory descriptor : found %d MB of RAM at 0x%08X\n", mem_info.size / SZ_1M, mem_info.phys_base);
248+
lprintk(" AVZ DT at physical address : %p\n", __fdt_addr);
249+
lprintk(" AVZ memory descriptor : found %ld MB of RAM at 0x%08lX\n", mem_info.size / SZ_1M, mem_info.phys_base);
250250

251251
memslot[MEMSLOT_AVZ].base_paddr = mem_info.phys_base;
252252
memslot[MEMSLOT_AVZ].base_vaddr = CONFIG_KERNEL_VADDR;
@@ -290,14 +290,14 @@ void loadME(unsigned int slotID, void *itb)
290290
lprintk("!! Missing load-addr in the agency node !!\n");
291291
BUG();
292292
}
293-
lprintk("ITB: Domain load addr = 0x%lx\n", dom_addr);
293+
lprintk("ITB: Domain load addr = 0x%x\n", dom_addr);
294294

295295
ret = fdt_property_read_u32(itb, nodeoffset, "entry", &entry_addr);
296296
if (ret == -1) {
297297
lprintk("!! Missing entry in the agency node !!\n");
298298
BUG();
299299
}
300-
lprintk("ITB: Domain entry addr = 0x%lx\n", entry_addr);
300+
lprintk("ITB: Domain entry addr = 0x%x\n", entry_addr);
301301

302302
/* Get the pointer to the OS binary image from the ITB we got from the user space. */
303303
ret = fit_image_get_data_and_size(itb, nodeoffset, (const void **) &ME_vaddr, &ME_size);

so3/avz/kernel/keyhandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void dump_domains(unsigned char key)
110110

111111
printk("General information for domain %u:\n", d->avz_shared->domID);
112112

113-
printk(" dying=%d nr_pages=%d max_pages=%u\n", d->is_dying, d->avz_shared->nr_pages, d->max_pages);
113+
printk(" dying=%d nr_pages=%ld max_pages=%u\n", d->is_dying, d->avz_shared->nr_pages, d->max_pages);
114114

115115
printk("VCPU information and callbacks for domain %u:\n", d->avz_shared->domID);
116116

so3/devices/irq/gic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void fdt_interrupt_node(int fdt_offset, irq_def_t *irq_def)
148148

149149
} else {
150150
/* Unsupported size of interrupts property */
151-
lprintk("%s: unsupported size of interrupts property\n");
151+
LOG_ERROR("unsupported size of interrupts property\n");
152152
BUG();
153153
}
154154
}

0 commit comments

Comments
 (0)