Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Geert Uytterhoeven
On Tue, Dec 20, 2016 at 11:44 PM, Andreas Schwab  wrote:
> On Dez 20 2016, Geert Uytterhoeven  wrote:
>> When I saw this patch, I was already a bit skeptical about it, but I noticed
>> other architectures (e.g. avr32) are doing the same, so I didn't reply.
>>
>> In my experience, "format '%zu' expects argument of type 'size_t', but
>> argument 3 has type 'unsigned int'" happens when using a compiler that
>> was not configured to use the correct type (should be unsigned long) for
>> size_t. Typically this happens when using a compiler not configured for
>> a Linux target.
>
> 32-bit targets typically use unsigned int for size_t.  It is part of the
> ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
> gcc defaults to unsigned long for size_t, mismatches can happen if
> people are using incomplete patches.

Right, thanks for correcting me!
It should indeed be unsigned int on 32-bit, and unsigned long on 64-bit.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Geert Uytterhoeven
On Tue, Dec 20, 2016 at 11:44 PM, Andreas Schwab  wrote:
> On Dez 20 2016, Geert Uytterhoeven  wrote:
>> When I saw this patch, I was already a bit skeptical about it, but I noticed
>> other architectures (e.g. avr32) are doing the same, so I didn't reply.
>>
>> In my experience, "format '%zu' expects argument of type 'size_t', but
>> argument 3 has type 'unsigned int'" happens when using a compiler that
>> was not configured to use the correct type (should be unsigned long) for
>> size_t. Typically this happens when using a compiler not configured for
>> a Linux target.
>
> 32-bit targets typically use unsigned int for size_t.  It is part of the
> ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
> gcc defaults to unsigned long for size_t, mismatches can happen if
> people are using incomplete patches.

Right, thanks for correcting me!
It should indeed be unsigned int on 32-bit, and unsigned long on 64-bit.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread kbuild test robot
Hi Stafford,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161221]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
config: openrisc-allnoconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   mm/slab_common.c: In function 'create_boot_cache':
>> mm/slab_common.c:816:6: warning: format '%zu' expects type 'size_t', but 
>> argument 3 has type 'long unsigned int'

vim +816 mm/slab_common.c

45530c44 Christoph Lameter 2012-11-28  800  /* Create a cache during boot when 
no slab services are available yet */
45530c44 Christoph Lameter 2012-11-28  801  void __init 
create_boot_cache(struct kmem_cache *s, const char *name, size_t size,
45530c44 Christoph Lameter 2012-11-28  802  unsigned long flags)
45530c44 Christoph Lameter 2012-11-28  803  {
45530c44 Christoph Lameter 2012-11-28  804  int err;
45530c44 Christoph Lameter 2012-11-28  805  
45530c44 Christoph Lameter 2012-11-28  806  s->name = name;
45530c44 Christoph Lameter 2012-11-28  807  s->size = s->object_size = size;
45906855 Christoph Lameter 2012-11-28  808  s->align = 
calculate_alignment(flags, ARCH_KMALLOC_MINALIGN, size);
f7ce3190 Vladimir Davydov  2015-02-12  809  
f7ce3190 Vladimir Davydov  2015-02-12  810  slab_init_memcg_params(s);
f7ce3190 Vladimir Davydov  2015-02-12  811  
45530c44 Christoph Lameter 2012-11-28  812  err = __kmem_cache_create(s, 
flags);
45530c44 Christoph Lameter 2012-11-28  813  
45530c44 Christoph Lameter 2012-11-28  814  if (err)
31ba7346 Christoph Lameter 2013-01-10  815  panic("Creation of 
kmalloc slab %s size=%zu failed. Reason %d\n",
45530c44 Christoph Lameter 2012-11-28 @816  
name, size, err);
45530c44 Christoph Lameter 2012-11-28  817  
45530c44 Christoph Lameter 2012-11-28  818  s->refcount = -1;   /* 
Exempt from merging for now */
45530c44 Christoph Lameter 2012-11-28  819  }
45530c44 Christoph Lameter 2012-11-28  820  
45530c44 Christoph Lameter 2012-11-28  821  struct kmem_cache *__init 
create_kmalloc_cache(const char *name, size_t size,
45530c44 Christoph Lameter 2012-11-28  822  
unsigned long flags)
45530c44 Christoph Lameter 2012-11-28  823  {
45530c44 Christoph Lameter 2012-11-28  824  struct kmem_cache *s = 
kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);

:: The code at line 816 was first introduced by commit
:: 45530c4474d258b822e2639c786606d8257aad8b mm, sl[au]b: create common 
functions for boot slab creation

:: TO: Christoph Lameter 
:: CC: Pekka Enberg 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread kbuild test robot
Hi Stafford,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161221]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
config: openrisc-allnoconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   mm/slab_common.c: In function 'create_boot_cache':
>> mm/slab_common.c:816:6: warning: format '%zu' expects type 'size_t', but 
>> argument 3 has type 'long unsigned int'

vim +816 mm/slab_common.c

45530c44 Christoph Lameter 2012-11-28  800  /* Create a cache during boot when 
no slab services are available yet */
45530c44 Christoph Lameter 2012-11-28  801  void __init 
create_boot_cache(struct kmem_cache *s, const char *name, size_t size,
45530c44 Christoph Lameter 2012-11-28  802  unsigned long flags)
45530c44 Christoph Lameter 2012-11-28  803  {
45530c44 Christoph Lameter 2012-11-28  804  int err;
45530c44 Christoph Lameter 2012-11-28  805  
45530c44 Christoph Lameter 2012-11-28  806  s->name = name;
45530c44 Christoph Lameter 2012-11-28  807  s->size = s->object_size = size;
45906855 Christoph Lameter 2012-11-28  808  s->align = 
calculate_alignment(flags, ARCH_KMALLOC_MINALIGN, size);
f7ce3190 Vladimir Davydov  2015-02-12  809  
f7ce3190 Vladimir Davydov  2015-02-12  810  slab_init_memcg_params(s);
f7ce3190 Vladimir Davydov  2015-02-12  811  
45530c44 Christoph Lameter 2012-11-28  812  err = __kmem_cache_create(s, 
flags);
45530c44 Christoph Lameter 2012-11-28  813  
45530c44 Christoph Lameter 2012-11-28  814  if (err)
31ba7346 Christoph Lameter 2013-01-10  815  panic("Creation of 
kmalloc slab %s size=%zu failed. Reason %d\n",
45530c44 Christoph Lameter 2012-11-28 @816  
name, size, err);
45530c44 Christoph Lameter 2012-11-28  817  
45530c44 Christoph Lameter 2012-11-28  818  s->refcount = -1;   /* 
Exempt from merging for now */
45530c44 Christoph Lameter 2012-11-28  819  }
45530c44 Christoph Lameter 2012-11-28  820  
45530c44 Christoph Lameter 2012-11-28  821  struct kmem_cache *__init 
create_kmalloc_cache(const char *name, size_t size,
45530c44 Christoph Lameter 2012-11-28  822  
unsigned long flags)
45530c44 Christoph Lameter 2012-11-28  823  {
45530c44 Christoph Lameter 2012-11-28  824  struct kmem_cache *s = 
kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);

:: The code at line 816 was first introduced by commit
:: 45530c4474d258b822e2639c786606d8257aad8b mm, sl[au]b: create common 
functions for boot slab creation

:: TO: Christoph Lameter 
:: CC: Pekka Enberg 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Stafford Horne
Hi,

On Tue, Dec 20, 2016 at 11:44:43PM +0100, Andreas Schwab wrote:
> On Dez 20 2016, Geert Uytterhoeven  wrote:
> 
> > When I saw this patch, I was already a bit skeptical about it, but I noticed
> > other architectures (e.g. avr32) are doing the same, so I didn't reply.
> >
> > In my experience, "format '%zu' expects argument of type 'size_t', but
> > argument 3 has type 'unsigned int'" happens when using a compiler that
> > was not configured to use the correct type (should be unsigned long) for
> > size_t. Typically this happens when using a compiler not configured for
> > a Linux target.
> 
> 32-bit targets typically use unsigned int for size_t.  It is part of the
> ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
> gcc defaults to unsigned long for size_t, mismatches can happen if
> people are using incomplete patches.

Thanks,

To tell the truth I was skeptical of this patch as well.  But I figured I
could send out the patch and see what kind of feedback it would get.  I
was expecting compiler actually, but wasn't sure exactly where.

So this is the best feedback I could have expected.  Thanks.

I am using gcc with newlib 'or1k-elf-'.  I also have a musl, linux,
target compiler.  I will look into that.

-Stafford


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Stafford Horne
Hi,

On Tue, Dec 20, 2016 at 11:44:43PM +0100, Andreas Schwab wrote:
> On Dez 20 2016, Geert Uytterhoeven  wrote:
> 
> > When I saw this patch, I was already a bit skeptical about it, but I noticed
> > other architectures (e.g. avr32) are doing the same, so I didn't reply.
> >
> > In my experience, "format '%zu' expects argument of type 'size_t', but
> > argument 3 has type 'unsigned int'" happens when using a compiler that
> > was not configured to use the correct type (should be unsigned long) for
> > size_t. Typically this happens when using a compiler not configured for
> > a Linux target.
> 
> 32-bit targets typically use unsigned int for size_t.  It is part of the
> ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
> gcc defaults to unsigned long for size_t, mismatches can happen if
> people are using incomplete patches.

Thanks,

To tell the truth I was skeptical of this patch as well.  But I figured I
could send out the patch and see what kind of feedback it would get.  I
was expecting compiler actually, but wasn't sure exactly where.

So this is the best feedback I could have expected.  Thanks.

I am using gcc with newlib 'or1k-elf-'.  I also have a musl, linux,
target compiler.  I will look into that.

-Stafford


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Andreas Schwab
On Dez 20 2016, Geert Uytterhoeven  wrote:

> When I saw this patch, I was already a bit skeptical about it, but I noticed
> other architectures (e.g. avr32) are doing the same, so I didn't reply.
>
> In my experience, "format '%zu' expects argument of type 'size_t', but
> argument 3 has type 'unsigned int'" happens when using a compiler that
> was not configured to use the correct type (should be unsigned long) for
> size_t. Typically this happens when using a compiler not configured for
> a Linux target.

32-bit targets typically use unsigned int for size_t.  It is part of the
ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
gcc defaults to unsigned long for size_t, mismatches can happen if
people are using incomplete patches.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Andreas Schwab
On Dez 20 2016, Geert Uytterhoeven  wrote:

> When I saw this patch, I was already a bit skeptical about it, but I noticed
> other architectures (e.g. avr32) are doing the same, so I didn't reply.
>
> In my experience, "format '%zu' expects argument of type 'size_t', but
> argument 3 has type 'unsigned int'" happens when using a compiler that
> was not configured to use the correct type (should be unsigned long) for
> size_t. Typically this happens when using a compiler not configured for
> a Linux target.

32-bit targets typically use unsigned int for size_t.  It is part of the
ABI, so all compilers must agree.  Since or32 is a out-of-tree port, and
gcc defaults to unsigned long for size_t, mismatches can happen if
people are using incomplete patches.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Geert Uytterhoeven
Hi Stafford,

On Tue, Dec 20, 2016 at 9:22 PM, kbuild test robot  wrote:
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.9 next-20161220]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
> config: openrisc-or1ksim_defconfig (attached as .config)
> compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=openrisc
>
> All warnings (new ones prefixed by >>):
>
>crypto/drbg.c: In function 'drbg_seed':
>>> crypto/drbg.c:1062:3: warning: format '%zu' expects type 'size_t', but 
>>> argument 2 has type 'long unsigned int'
>crypto/drbg.c: In function 'drbg_generate':
>crypto/drbg.c:1275:3: warning: format '%zu' expects type 'size_t', but 
> argument 2 has type 'long unsigned int'

When I saw this patch, I was already a bit skeptical about it, but I noticed
other architectures (e.g. avr32) are doing the same, so I didn't reply.

In my experience, "format '%zu' expects argument of type 'size_t', but
argument 3 has type 'unsigned int'" happens when using a compiler that
was not configured to use the correct type (should be unsigned long) for
size_t. Typically this happens when using a compiler not configured for
a Linux target.

Given 0day uses a compiler configured for Linux (or32-linux-gcc), your
patch seems to break such (correct) setups.

What kind of compiler are you using?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Geert Uytterhoeven
Hi Stafford,

On Tue, Dec 20, 2016 at 9:22 PM, kbuild test robot  wrote:
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.9 next-20161220]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
> config: openrisc-or1ksim_defconfig (attached as .config)
> compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
> reproduce:
> wget 
> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>  -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=openrisc
>
> All warnings (new ones prefixed by >>):
>
>crypto/drbg.c: In function 'drbg_seed':
>>> crypto/drbg.c:1062:3: warning: format '%zu' expects type 'size_t', but 
>>> argument 2 has type 'long unsigned int'
>crypto/drbg.c: In function 'drbg_generate':
>crypto/drbg.c:1275:3: warning: format '%zu' expects type 'size_t', but 
> argument 2 has type 'long unsigned int'

When I saw this patch, I was already a bit skeptical about it, but I noticed
other architectures (e.g. avr32) are doing the same, so I didn't reply.

In my experience, "format '%zu' expects argument of type 'size_t', but
argument 3 has type 'unsigned int'" happens when using a compiler that
was not configured to use the correct type (should be unsigned long) for
size_t. Typically this happens when using a compiler not configured for
a Linux target.

Given 0day uses a compiler configured for Linux (or32-linux-gcc), your
patch seems to break such (correct) setups.

What kind of compiler are you using?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread kbuild test robot
Hi Stafford,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   crypto/drbg.c: In function 'drbg_seed':
>> crypto/drbg.c:1062:3: warning: format '%zu' expects type 'size_t', but 
>> argument 2 has type 'long unsigned int'
   crypto/drbg.c: In function 'drbg_generate':
   crypto/drbg.c:1275:3: warning: format '%zu' expects type 'size_t', but 
argument 2 has type 'long unsigned int'
--
   drivers/base/component.c: In function 'find_components':
>> drivers/base/component.c:101:3: warning: format '%zu' expects type 'size_t', 
>> but argument 4 has type 'long unsigned int'
--
   drivers/char/random.c: In function 'urandom_read':
>> drivers/char/random.c:1749:10: warning: format '%zd' expects type 'signed 
>> size_t', but argument 3 has type 'size_t'
   drivers/char/random.c: In function 'write_pool':
>> drivers/char/random.c:1783:11: warning: comparison of distinct pointer types 
>> lacks a cast
--
   drivers/tty/serial/earlycon.c: In function 'earlycon_init':
>> drivers/tty/serial/earlycon.c:74:32: warning: comparison of distinct pointer 
>> types lacks a cast
--
   fs/libfs.c: In function 'simple_attr_write':
>> fs/libfs.c:876:9: warning: comparison of distinct pointer types lacks a cast
--
   lib/iov_iter.c: In function 'sanity':
>> lib/iov_iter.c:319:2: warning: format '%zd' expects type 'signed size_t', 
>> but argument 3 has type 'size_t'
--
   lib/kstrtox.c: In function 'kstrtobool_from_user':
>> lib/kstrtox.c:376:10: warning: comparison of distinct pointer types lacks a 
>> cast
   lib/kstrtox.c: In function 'kstrtoull_from_user':
   lib/kstrtox.c:398:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtoll_from_user':
   lib/kstrtox.c:399:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtoul_from_user':
   lib/kstrtox.c:400:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtol_from_user':
   lib/kstrtox.c:401:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtouint_from_user':
   lib/kstrtox.c:402:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtoint_from_user':
   lib/kstrtox.c:403:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtou16_from_user':
   lib/kstrtox.c:404:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtos16_from_user':
   lib/kstrtox.c:405:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtou8_from_user':
   lib/kstrtox.c:406:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtos8_from_user':
   lib/kstrtox.c:407:1: warning: comparison of distinct pointer types lacks a 
cast
--
   In file included from mm/percpu.c:822:0:
   mm/percpu-km.c: In function 'pcpu_verify_alloc_info':
>> mm/percpu-km.c:106:3: warning: format '%zu' expects type 'size_t', but 
>> argument 2 has type 'long unsigned int'
   mm/percpu.c: In function 'pcpu_alloc':
>> mm/percpu.c:891:3: warning: format '%zu' expects type 'size_t', but argument 
>> 4 has type 'long unsigned int'
   mm/percpu.c:891:3: warning: format '%zu' expects type 'size_t', but argument 
5 has type 'long unsigned int'
   mm/percpu.c:1032:3: warning: format '%zu' expects type 'size_t', but 
argument 2 has type 'long unsigned int'
   mm/percpu.c:1032:3: warning: format '%zu' expects type 'size_t', but 
argument 3 has type 'long unsigned int'
   mm/percpu.c: In function 'pcpu_dump_alloc_info':
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 3 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 4 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 5 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 6 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 7 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 8 has type 'long 

Re: [PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread kbuild test robot
Hi Stafford,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161220]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stafford-Horne/openrisc-Define-__kernel_size_t-to-suppress-compiler-warnings/20161221-024243
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   crypto/drbg.c: In function 'drbg_seed':
>> crypto/drbg.c:1062:3: warning: format '%zu' expects type 'size_t', but 
>> argument 2 has type 'long unsigned int'
   crypto/drbg.c: In function 'drbg_generate':
   crypto/drbg.c:1275:3: warning: format '%zu' expects type 'size_t', but 
argument 2 has type 'long unsigned int'
--
   drivers/base/component.c: In function 'find_components':
>> drivers/base/component.c:101:3: warning: format '%zu' expects type 'size_t', 
>> but argument 4 has type 'long unsigned int'
--
   drivers/char/random.c: In function 'urandom_read':
>> drivers/char/random.c:1749:10: warning: format '%zd' expects type 'signed 
>> size_t', but argument 3 has type 'size_t'
   drivers/char/random.c: In function 'write_pool':
>> drivers/char/random.c:1783:11: warning: comparison of distinct pointer types 
>> lacks a cast
--
   drivers/tty/serial/earlycon.c: In function 'earlycon_init':
>> drivers/tty/serial/earlycon.c:74:32: warning: comparison of distinct pointer 
>> types lacks a cast
--
   fs/libfs.c: In function 'simple_attr_write':
>> fs/libfs.c:876:9: warning: comparison of distinct pointer types lacks a cast
--
   lib/iov_iter.c: In function 'sanity':
>> lib/iov_iter.c:319:2: warning: format '%zd' expects type 'signed size_t', 
>> but argument 3 has type 'size_t'
--
   lib/kstrtox.c: In function 'kstrtobool_from_user':
>> lib/kstrtox.c:376:10: warning: comparison of distinct pointer types lacks a 
>> cast
   lib/kstrtox.c: In function 'kstrtoull_from_user':
   lib/kstrtox.c:398:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtoll_from_user':
   lib/kstrtox.c:399:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtoul_from_user':
   lib/kstrtox.c:400:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtol_from_user':
   lib/kstrtox.c:401:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtouint_from_user':
   lib/kstrtox.c:402:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtoint_from_user':
   lib/kstrtox.c:403:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtou16_from_user':
   lib/kstrtox.c:404:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtos16_from_user':
   lib/kstrtox.c:405:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtou8_from_user':
   lib/kstrtox.c:406:1: warning: comparison of distinct pointer types lacks a 
cast
   lib/kstrtox.c: In function 'kstrtos8_from_user':
   lib/kstrtox.c:407:1: warning: comparison of distinct pointer types lacks a 
cast
--
   In file included from mm/percpu.c:822:0:
   mm/percpu-km.c: In function 'pcpu_verify_alloc_info':
>> mm/percpu-km.c:106:3: warning: format '%zu' expects type 'size_t', but 
>> argument 2 has type 'long unsigned int'
   mm/percpu.c: In function 'pcpu_alloc':
>> mm/percpu.c:891:3: warning: format '%zu' expects type 'size_t', but argument 
>> 4 has type 'long unsigned int'
   mm/percpu.c:891:3: warning: format '%zu' expects type 'size_t', but argument 
5 has type 'long unsigned int'
   mm/percpu.c:1032:3: warning: format '%zu' expects type 'size_t', but 
argument 2 has type 'long unsigned int'
   mm/percpu.c:1032:3: warning: format '%zu' expects type 'size_t', but 
argument 3 has type 'long unsigned int'
   mm/percpu.c: In function 'pcpu_dump_alloc_info':
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 3 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 4 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 5 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 6 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 7 has type 'long unsigned int'
   mm/percpu.c:1460:9: warning: format '%zu' expects type 'size_t', but 
argument 8 has type 'long 

[PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Stafford Horne
The current build throws numerous warnings like:

  mm/percpu.c:1442:9: warning: format '%zu' expects argument of type
  'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
 ai->unit_size, ai->alloc_size / ai->atom_size, ai->atom_size);
 ^
  mm/percpu.c:1442:9: warning: format '%zu' expects argument of type
  'size_t', but argument 4 has type 'unsigned int' [-Wformat=]

This change defines size_t as unsigned long, after this change there are
no warnings.

Signed-off-by: Stafford Horne 
---
 arch/openrisc/include/asm/Kbuild |  1 -
 arch/openrisc/include/uapi/asm/Kbuild|  1 +
 arch/openrisc/include/uapi/asm/posix_types.h | 24 
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 arch/openrisc/include/uapi/asm/posix_types.h

diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index a669c14..98d69c5 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -40,7 +40,6 @@ generic-y += msgbuf.h
 generic-y += pci.h
 generic-y += percpu.h
 generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
 generic-y += resource.h
 generic-y += sections.h
diff --git a/arch/openrisc/include/uapi/asm/Kbuild 
b/arch/openrisc/include/uapi/asm/Kbuild
index 80761eb..c09b436 100644
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ b/arch/openrisc/include/uapi/asm/Kbuild
@@ -5,6 +5,7 @@ header-y += byteorder.h
 header-y += elf.h
 header-y += kvm_para.h
 header-y += param.h
+header-y += posix_types.h
 header-y += ptrace.h
 header-y += sigcontext.h
 header-y += unistd.h
diff --git a/arch/openrisc/include/uapi/asm/posix_types.h 
b/arch/openrisc/include/uapi/asm/posix_types.h
new file mode 100644
index 000..9b71c3f
--- /dev/null
+++ b/arch/openrisc/include/uapi/asm/posix_types.h
@@ -0,0 +1,24 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2016 by Stafford Horne
+ */
+#ifndef _ASM_POSIX_TYPES_H
+#define _ASM_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long  __kernel_size_t;
+typedef long   __kernel_ssize_t;
+typedef long   __kernel_ptrdiff_t;
+#define __kernel_size_t __kernel_size_t
+
+#include 
+
+#endif /* _ASM_POSIX_TYPES_H */
-- 
2.7.4



[PATCH] openrisc: Define __kernel_size_t to suppress compiler warnings

2016-12-20 Thread Stafford Horne
The current build throws numerous warnings like:

  mm/percpu.c:1442:9: warning: format '%zu' expects argument of type
  'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
 ai->unit_size, ai->alloc_size / ai->atom_size, ai->atom_size);
 ^
  mm/percpu.c:1442:9: warning: format '%zu' expects argument of type
  'size_t', but argument 4 has type 'unsigned int' [-Wformat=]

This change defines size_t as unsigned long, after this change there are
no warnings.

Signed-off-by: Stafford Horne 
---
 arch/openrisc/include/asm/Kbuild |  1 -
 arch/openrisc/include/uapi/asm/Kbuild|  1 +
 arch/openrisc/include/uapi/asm/posix_types.h | 24 
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 arch/openrisc/include/uapi/asm/posix_types.h

diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index a669c14..98d69c5 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -40,7 +40,6 @@ generic-y += msgbuf.h
 generic-y += pci.h
 generic-y += percpu.h
 generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
 generic-y += resource.h
 generic-y += sections.h
diff --git a/arch/openrisc/include/uapi/asm/Kbuild 
b/arch/openrisc/include/uapi/asm/Kbuild
index 80761eb..c09b436 100644
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ b/arch/openrisc/include/uapi/asm/Kbuild
@@ -5,6 +5,7 @@ header-y += byteorder.h
 header-y += elf.h
 header-y += kvm_para.h
 header-y += param.h
+header-y += posix_types.h
 header-y += ptrace.h
 header-y += sigcontext.h
 header-y += unistd.h
diff --git a/arch/openrisc/include/uapi/asm/posix_types.h 
b/arch/openrisc/include/uapi/asm/posix_types.h
new file mode 100644
index 000..9b71c3f
--- /dev/null
+++ b/arch/openrisc/include/uapi/asm/posix_types.h
@@ -0,0 +1,24 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2016 by Stafford Horne
+ */
+#ifndef _ASM_POSIX_TYPES_H
+#define _ASM_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long  __kernel_size_t;
+typedef long   __kernel_ssize_t;
+typedef long   __kernel_ptrdiff_t;
+#define __kernel_size_t __kernel_size_t
+
+#include 
+
+#endif /* _ASM_POSIX_TYPES_H */
-- 
2.7.4