From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: Re: [PATCH] mini-os: enable compiler check for printk format types Date: Thu, 7 Aug 2014 16:55:09 +0200 Message-ID: <20140807145509.GK3426@type.youpi.perso.aquilenet.fr> References: <1407318240-1799-1-git-send-email-talex5@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFP6d-00050j-7T for xen-devel@lists.xenproject.org; Thu, 07 Aug 2014 14:55:51 +0000 Content-Disposition: inline In-Reply-To: <1407318240-1799-1-git-send-email-talex5@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Thomas Leonard Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com, Dave.Scott@eu.citrix.com, anil@recoil.org List-Id: xen-devel@lists.xenproject.org Thomas Leonard, le Wed 06 Aug 2014 10:44:00 +0100, a =E9crit : > @@ -326,7 +326,7 @@ static void set_readonly(void *text, void *etext) > count++; > } > else > - printk("skipped %p\n", start_address); > + printk("skipped %lx\n", start_address); Please prepend 0x, and likewise further down. > @@ -369,21 +369,21 @@ int mem_test(unsigned long *start_va, unsigned long= *end_va, int verbose) > /* write values and print page walks */ > if ( verbose && (((unsigned long)start_va) & 0xfffff) ) > { > - printk("MemTest Start: 0x%lx\n", start_va); > + printk("MemTest Start: 0x%p\n", start_va); Please drop 0x, and likewise further down. > @@ -516,7 +516,7 @@ void arch_init_demand_mapping_area(unsigned long cur_= pfn) > = > demand_map_area_start =3D (unsigned long) pfn_to_virt(cur_pfn); > cur_pfn +=3D DEMAND_MAP_PAGES; > - printk("Demand map pfns at %lx-%lx.\n", = > + printk("Demand map pfns at %lx-%p.\n", = Please prepend 0x to %lx too, to have coherency. > @@ -1421,7 +1421,7 @@ void sparse(unsigned long data, size_t size) > mfns[i] =3D virtual_to_mfn(data + i * PAGE_SIZE); > } > = > - printk("sparsing %ldMB at %lx\n", size >> 20, data); > + printk("sparsing %ldMB at %lx\n", (long) size >> 20, data); Please cast into long after the shift, not before. > @@ -236,7 +236,7 @@ sys_thread_t sys_thread_new(char *name, void (* threa= d)(void *arg), void *arg, i > { > struct thread *t; > if (stacksize > STACK_SIZE) { > - printk("Can't start lwIP thread: stack size %d is too large for our %d\= n", stacksize, STACK_SIZE); > + printk("Can't start lwIP thread: stack size %d is too large for our %d\= n", stacksize, (int) STACK_SIZE); Please rather cast to long and use %lu. > diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c > index 44c3995..6f335fe 100644 > --- a/extras/mini-os/netfront.c > +++ b/extras/mini-os/netfront.c > @@ -327,8 +327,8 @@ struct netfront_dev *init_netfront(char *_nodename, v= oid (*thenetif_rx)(unsigned > dev->fd =3D -1; > #endif > = > - printk("net TX ring size %d\n", NET_TX_RING_SIZE); > - printk("net RX ring size %d\n", NET_RX_RING_SIZE); > + printk("net TX ring size %llu\n", (unsigned long long) NET_TX_RING_S= IZE); > + printk("net RX ring size %llu\n", (unsigned long long) NET_RX_RING_S= IZE); lib/printf.c does not actually support %ll yet, it uses %L instead. We'd rather not write code using that until somebody fixes lib/printf.c. Here casting to unsigned long and using %lu will be way enough anyway. Samuel