Hi Arnaud,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.3-rc6 next-20190829]
[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/Arnaud-Pouliquen/rpmsg-core-add-API-to-get-message-length/20190829-222443
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.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
        GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

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

All warnings (new ones prefixed by >>):

   In file included from include/linux/list.h:9:0,
                    from include/linux/module.h:9,
                    from drivers/tty/rpmsg_tty.c:7:
   drivers/tty/rpmsg_tty.c: In function 'rpmsg_tty_write':
   include/linux/kernel.h:821:29: warning: comparison of distinct pointer types 
lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:835:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:854:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> drivers/tty/rpmsg_tty.c:152:13: note: in expansion of macro 'min'
     msg_size = min(len, msg_max_size);
                ^~~

vim +/min +152 drivers/tty/rpmsg_tty.c

   132  
   133  static int rpmsg_tty_write(struct tty_struct *tty, const u8 *buf, int 
len)
   134  {
   135          struct rpmsg_tty_port *cport = tty->driver_data;
   136          struct rpmsg_device *rpdev;
   137          ssize_t msg_max_size, msg_size;
   138          int ret;
   139          u8 *tmpbuf;
   140  
   141          /* If cts not set, the message is not sent*/
   142          if (!cport->cts)
   143                  return 0;
   144  
   145          rpdev = cport->rpdev;
   146  
   147          dev_dbg(&rpdev->dev, "%s: send msg from tty->index = %d, len = 
%d\n",
   148                  __func__, tty->index, len);
   149  
   150          msg_max_size = rpmsg_get_mtu(rpdev->ept);
   151  
 > 152          msg_size = min(len, msg_max_size);
   153          tmpbuf = kzalloc(msg_size, GFP_KERNEL);
   154          if (!tmpbuf)
   155                  return -ENOMEM;
   156  
   157          memcpy(tmpbuf, buf, msg_size);
   158  
   159          /*
   160           * Try to send the message to remote processor, if failed 
return 0 as
   161           * no data sent
   162           */
   163          ret = rpmsg_trysendto(cport->d_ept, tmpbuf, msg_size, 
cport->data_dst);
   164          kfree(tmpbuf);
   165          if (ret) {
   166                  dev_dbg(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
   167                  return 0;
   168          }
   169  
   170          return msg_size;
   171  }
   172  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to