All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Thomas Leonard <talex5@gmail.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com,
	Dave.Scott@eu.citrix.com, anil@recoil.org
Subject: Re: [PATCH] mini-os: enable compiler check for printk format types
Date: Thu, 7 Aug 2014 16:55:09 +0200	[thread overview]
Message-ID: <20140807145509.GK3426@type.youpi.perso.aquilenet.fr> (raw)
In-Reply-To: <1407318240-1799-1-git-send-email-talex5@gmail.com>

Thomas Leonard, le Wed 06 Aug 2014 10:44:00 +0100, a écrit :
> @@ -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 = (unsigned long) pfn_to_virt(cur_pfn);
>      cur_pfn += 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] = 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 (* thread)(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, void (*thenetif_rx)(unsigned
>      dev->fd = -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_SIZE);
> +    printk("net RX ring size %llu\n", (unsigned long long) NET_RX_RING_SIZE);

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

  parent reply	other threads:[~2014-08-07 14:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06  9:44 [PATCH] mini-os: enable compiler check for printk format types Thomas Leonard
2014-08-06 16:29 ` Andrew Cooper
2014-08-07  6:33   ` Jan Beulich
2014-08-07 14:55 ` Samuel Thibault [this message]
2014-08-08  8:50   ` Thomas Leonard
2014-08-08 14:28   ` Thomas Leonard
2014-08-08 14:32     ` Samuel Thibault
2014-10-03  8:44       ` Thomas Leonard
2014-10-03  8:55         ` Ian Campbell
2014-10-05 19:30           ` Samuel Thibault
2014-10-06 13:28             ` Ian Campbell
2014-10-07 16:04               ` Samuel Thibault
2014-10-08 11:12               ` Thomas Leonard
2014-10-08 11:16                 ` Andrew Cooper
2014-10-08 11:25                 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140807145509.GK3426@type.youpi.perso.aquilenet.fr \
    --to=samuel.thibault@ens-lyon.org \
    --cc=Dave.Scott@eu.citrix.com \
    --cc=anil@recoil.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=talex5@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.