Re: [PATCH] media: cx25821: prevent out-of-bounds read on array card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Colin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.15 next-20180202]
[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/Colin-King/media-cx25821-prevent-out-of-bounds-read-on-array-card/20180203-130958
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-sb0-02031534 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:15:0,
                    from include/linux/list.h:9,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from include/linux/i2c.h:30,
                    from drivers/media/pci/cx25821/cx25821-core.c:22:
   drivers/media/pci/cx25821/cx25821-core.c: In function 'cx25821_dev_setup':
>> include/linux/build_bug.h:30:45: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
                                                ^
   include/linux/compiler-gcc.h:65:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
>> include/linux/printk.h:308:34: note: in expansion of macro 'ARRAY_SIZE'
     printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                     ^
   drivers/media/pci/cx25821/cx25821.h:380:2: note: in expansion of macro 'pr_info'
     pr_info("(%d): " fmt, dev->board, ##args)
     ^
   drivers/media/pci/cx25821/cx25821-core.c:871:3: note: in expansion of macro 'CX25821_INFO'
      CX25821_INFO("dev->nr >= %ld", ARRAY_SIZE(card));
      ^
--
   In file included from include/linux/kernel.h:15:0,
                    from include/linux/list.h:9,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from include/linux/i2c.h:30,
                    from drivers/media//pci/cx25821/cx25821-core.c:22:
   drivers/media//pci/cx25821/cx25821-core.c: In function 'cx25821_dev_setup':
>> include/linux/build_bug.h:30:45: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); }))
                                                ^
   include/linux/compiler-gcc.h:65:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:71:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
>> include/linux/printk.h:308:34: note: in expansion of macro 'ARRAY_SIZE'
     printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
                                     ^
   drivers/media//pci/cx25821/cx25821.h:380:2: note: in expansion of macro 'pr_info'
     pr_info("(%d): " fmt, dev->board, ##args)
     ^
   drivers/media//pci/cx25821/cx25821-core.c:871:3: note: in expansion of macro 'CX25821_INFO'
      CX25821_INFO("dev->nr >= %ld", ARRAY_SIZE(card));
      ^

vim +/ARRAY_SIZE +308 include/linux/printk.h

968ab183 Linus Torvalds 2010-11-15  287  
6e099f55 Dan Streetman  2014-06-04  288  /*
6e099f55 Dan Streetman  2014-06-04  289   * These can be used to print at the various log levels.
6e099f55 Dan Streetman  2014-06-04  290   * All of these will print unconditionally, although note that pr_debug()
6e099f55 Dan Streetman  2014-06-04  291   * and other debug macros are compiled out unless either DEBUG is defined
6e099f55 Dan Streetman  2014-06-04  292   * or CONFIG_DYNAMIC_DEBUG is set.
6e099f55 Dan Streetman  2014-06-04  293   */
a0cba217 Linus Torvalds 2016-08-09  294  #define pr_emerg(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  295  	printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  296  #define pr_alert(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  297  	printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  298  #define pr_crit(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  299  	printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  300  #define pr_err(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  301  	printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  302  #define pr_warning(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  303  	printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  304  #define pr_warn pr_warning
a0cba217 Linus Torvalds 2016-08-09  305  #define pr_notice(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09  306  	printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
a0cba217 Linus Torvalds 2016-08-09  307  #define pr_info(fmt, ...) \
a0cba217 Linus Torvalds 2016-08-09 @308  	printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
7b1460ec Steven Rostedt 2015-04-15  309  /*
7b1460ec Steven Rostedt 2015-04-15  310   * Like KERN_CONT, pr_cont() should only be used when continuing
7b1460ec Steven Rostedt 2015-04-15  311   * a line with no newline ('\n') enclosed. Otherwise it defaults
7b1460ec Steven Rostedt 2015-04-15  312   * back to KERN_DEFAULT.
7b1460ec Steven Rostedt 2015-04-15  313   */
968ab183 Linus Torvalds 2010-11-15  314  #define pr_cont(fmt, ...) \
968ab183 Linus Torvalds 2010-11-15  315  	printk(KERN_CONT fmt, ##__VA_ARGS__)
968ab183 Linus Torvalds 2010-11-15  316  

:::::: The code at line 308 was first introduced by commit
:::::: a0cba2179ea4c1820fce2ee046b6ed90ecc56196 Revert "printk: create pr_<level> functions"

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux