Hi "Aneesh,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.7-rc4 next-20200507]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    
https://github.com/0day-ci/linux/commits/Aneesh-Kumar-K-V/powerpc-va-Add-a-__va-variant-that-doesn-t-do-input-validation/20200508-042829
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross 
ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <l...@intel.com>

All warnings (new ones prefixed by >>):

   arch/powerpc/platforms/powernv/opal-core.c: In function 'read_opalcore':
>> arch/powerpc/platforms/powernv/opal-core.c:199:20: warning: passing argument 
>> 1 of '__va' makes integer from pointer without a cast [-Wint-conversion]
     199 |    memcpy(to, __va(addr), tsz);
         |                    ^~~~
         |                    |
         |                    void *
   In file included from arch/powerpc/include/asm/mmu.h:132,
                    from arch/powerpc/include/asm/lppaca.h:47,
                    from arch/powerpc/include/asm/paca.h:17,
                    from arch/powerpc/include/asm/current.h:13,
                    from include/linux/thread_info.h:21,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/powerpc/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/memblock.h:13,
                    from arch/powerpc/platforms/powernv/opal-core.c:11:
   arch/powerpc/include/asm/page.h:229:38: note: expected 'phys_addr_t' {aka 
'long long unsigned int'} but argument is of type 'void *'
     229 | static inline void *__va(phys_addr_t addr)
         |                          ~~~~~~~~~~~~^~~~

vim +/__va +199 arch/powerpc/platforms/powernv/opal-core.c

6f713d18144ce86 Hari Bathini 2019-09-11  156  
6f713d18144ce86 Hari Bathini 2019-09-11  157  /*
6f713d18144ce86 Hari Bathini 2019-09-11  158   * Read from the ELF header and 
then the crash dump.
6f713d18144ce86 Hari Bathini 2019-09-11  159   * Returns number of bytes read 
on success, -errno on failure.
6f713d18144ce86 Hari Bathini 2019-09-11  160   */
6f713d18144ce86 Hari Bathini 2019-09-11  161  static ssize_t 
read_opalcore(struct file *file, struct kobject *kobj,
6f713d18144ce86 Hari Bathini 2019-09-11  162                         struct 
bin_attribute *bin_attr, char *to,
6f713d18144ce86 Hari Bathini 2019-09-11  163                         loff_t 
pos, size_t count)
6f713d18144ce86 Hari Bathini 2019-09-11  164  {
6f713d18144ce86 Hari Bathini 2019-09-11  165    struct opalcore *m;
6f713d18144ce86 Hari Bathini 2019-09-11  166    ssize_t tsz, avail;
6f713d18144ce86 Hari Bathini 2019-09-11  167    loff_t tpos = pos;
6f713d18144ce86 Hari Bathini 2019-09-11  168  
6f713d18144ce86 Hari Bathini 2019-09-11  169    if (pos >= 
oc_conf->opalcore_size)
6f713d18144ce86 Hari Bathini 2019-09-11  170            return 0;
6f713d18144ce86 Hari Bathini 2019-09-11  171  
6f713d18144ce86 Hari Bathini 2019-09-11  172    /* Adjust count if it goes 
beyond opalcore size */
6f713d18144ce86 Hari Bathini 2019-09-11  173    avail = oc_conf->opalcore_size 
- pos;
6f713d18144ce86 Hari Bathini 2019-09-11  174    if (count > avail)
6f713d18144ce86 Hari Bathini 2019-09-11  175            count = avail;
6f713d18144ce86 Hari Bathini 2019-09-11  176  
6f713d18144ce86 Hari Bathini 2019-09-11  177    if (count == 0)
6f713d18144ce86 Hari Bathini 2019-09-11  178            return 0;
6f713d18144ce86 Hari Bathini 2019-09-11  179  
6f713d18144ce86 Hari Bathini 2019-09-11  180    /* Read ELF core header and/or 
PT_NOTE segment */
6f713d18144ce86 Hari Bathini 2019-09-11  181    if (tpos < 
oc_conf->opalcorebuf_sz) {
6f713d18144ce86 Hari Bathini 2019-09-11  182            tsz = min_t(size_t, 
oc_conf->opalcorebuf_sz - tpos, count);
6f713d18144ce86 Hari Bathini 2019-09-11  183            memcpy(to, 
oc_conf->opalcorebuf + tpos, tsz);
6f713d18144ce86 Hari Bathini 2019-09-11  184            to += tsz;
6f713d18144ce86 Hari Bathini 2019-09-11  185            tpos += tsz;
6f713d18144ce86 Hari Bathini 2019-09-11  186            count -= tsz;
6f713d18144ce86 Hari Bathini 2019-09-11  187    }
6f713d18144ce86 Hari Bathini 2019-09-11  188  
6f713d18144ce86 Hari Bathini 2019-09-11  189    list_for_each_entry(m, 
&opalcore_list, list) {
6f713d18144ce86 Hari Bathini 2019-09-11  190            /* nothing more to read 
here */
6f713d18144ce86 Hari Bathini 2019-09-11  191            if (count == 0)
6f713d18144ce86 Hari Bathini 2019-09-11  192                    break;
6f713d18144ce86 Hari Bathini 2019-09-11  193  
6f713d18144ce86 Hari Bathini 2019-09-11  194            if (tpos < m->offset + 
m->size) {
6f713d18144ce86 Hari Bathini 2019-09-11  195                    void *addr;
6f713d18144ce86 Hari Bathini 2019-09-11  196  
6f713d18144ce86 Hari Bathini 2019-09-11  197                    tsz = 
min_t(size_t, m->offset + m->size - tpos, count);
6f713d18144ce86 Hari Bathini 2019-09-11  198                    addr = (void 
*)(m->paddr + tpos - m->offset);
6f713d18144ce86 Hari Bathini 2019-09-11 @199                    memcpy(to, 
__va(addr), tsz);
6f713d18144ce86 Hari Bathini 2019-09-11  200                    to += tsz;
6f713d18144ce86 Hari Bathini 2019-09-11  201                    tpos += tsz;
6f713d18144ce86 Hari Bathini 2019-09-11  202                    count -= tsz;
6f713d18144ce86 Hari Bathini 2019-09-11  203            }
6f713d18144ce86 Hari Bathini 2019-09-11  204    }
6f713d18144ce86 Hari Bathini 2019-09-11  205  
6f713d18144ce86 Hari Bathini 2019-09-11  206    return (tpos - pos);
6f713d18144ce86 Hari Bathini 2019-09-11  207  }
6f713d18144ce86 Hari Bathini 2019-09-11  208  

:::::: The code at line 199 was first introduced by commit
:::::: 6f713d18144ce86c9f01cdf64222d6339e26129e powerpc/opalcore: export 
/sys/firmware/opal/core for analysing opal crashes

:::::: TO: Hari Bathini <hbath...@linux.vnet.ibm.com>
:::::: CC: Michael Ellerman <m...@ellerman.id.au>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to