← Back to team overview

kernel-packages team mailing list archive

[Bug 1321791] Re: Warnings when building out-of-tree module with -Wsign-compare

 

** Branch linked: lp:ubuntu/precise-proposed/linux-lts-trusty

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1321791

Title:
  Warnings when building out-of-tree module with -Wsign-compare

Status in “linux” package in Ubuntu:
  Fix Released
Status in “linux” source package in Trusty:
  Fix Committed
Status in “linux” source package in Utopic:
  Fix Released

Bug description:
  Bug originally reported and fixes provided by Brian Hart, IBM.

  Various warnings will be seen when building an out-of-tree module with
  -Wsign-compare if any of the following are included:

  include/linux/bitops.h
  include/linux/cpumask.h
  include/linux/fb.h

  Seen on post-release 14.04, with current kernel headers.

  
  Example...

  Makefile:
  ----------------------------------------
  obj-m := sample.o

  EXTRA_CFLAGS = -Wsign-compare
  ----------------------------------------

  sample.c:
  ----------------------------------------
  #include <linux/init.h>
  #include <linux/module.h>
  #include <linux/bitops.h>
  #include <linux/cpumask.h>
  #include <linux/fb.h>

  MODULE_LICENSE("GPL");

  static int sample_init(void)
  {
      printk(KERN_ALERT "sample init\n");
      return 0;
  }

  static void sample_term(void)
  {
      printk(KERN_ALERT "sample term\n");
      return;
  }

  module_init(sample_init)
  module_exit(sample_term)
  ----------------------------------------

  $ ARCH=powerpc make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules
  ...
  include/asm-generic/bitops/const_hweight.h:27:70: warning: signed and unsigned type in conditional expression [-Wsign-...
  ..
  include/linux/cpumask.h:603:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]
  ...
  include/linux/fb.h:650:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  ...

  
  Fix:
  -----

  upstream commits:
  - bitops.h: linux  c32fa99f0b4252633aa464e28d1cb925bd2a79df 
  - cpumask.h: linux-next  cea092c9488cbb22c8b70336ab1413e0daf350f0
  - fb.h: linux-next  ee3468739ed83d862dbbd90397aff5258f8f2c8e

  Patches will be sent to the kernel-team mailing list.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1321791/+subscriptions


References