lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108191428.qbfM9lnf-lkp@intel.com>
Date:   Thu, 19 Aug 2021 14:39:36 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [kees:kspp/array-bounds/next-20210816/v1 7/10]
 drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is
 not an array, pointer, or vector

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git kspp/array-bounds/next-20210816/v1
head:   b07d5e8190ca172b1ffddd1412b921296000b379
commit: 3b3fe3f0ff785b437a70e29fd96037e46972968a [7/10] treewide: Replace open-coded flex arrays in unions
config: i386-randconfig-a012-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=3b3fe3f0ff785b437a70e29fd96037e46972968a
        git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
        git fetch --no-tags kees kspp/array-bounds/next-20210816/v1
        git checkout 3b3fe3f0ff785b437a70e29fd96037e46972968a
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=i386 SHELL=/bin/bash drivers/char/ drivers/net/can/usb/etas_es58x/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

>> drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is not an array, pointer, or vector
           tx_can_msg = (typeof(tx_can_msg))&es581_4_urb_cmd->raw_msg[msg_len];
                                             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
   1 error generated.


vim +374 drivers/net/can/usb/etas_es58x/es581_4.c

1dfb6005a60b13 Vincent Mailhol 2021-04-10  342  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  343  static int es581_4_tx_can_msg(struct es58x_priv *priv,
1dfb6005a60b13 Vincent Mailhol 2021-04-10  344  			      const struct sk_buff *skb)
1dfb6005a60b13 Vincent Mailhol 2021-04-10  345  {
1dfb6005a60b13 Vincent Mailhol 2021-04-10  346  	struct es58x_device *es58x_dev = priv->es58x_dev;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  347  	union es58x_urb_cmd *urb_cmd = priv->tx_urb->transfer_buffer;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  348  	struct es581_4_urb_cmd *es581_4_urb_cmd = &urb_cmd->es581_4_urb_cmd;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  349  	struct can_frame *cf = (struct can_frame *)skb->data;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  350  	struct es581_4_tx_can_msg *tx_can_msg;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  351  	u16 msg_len;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  352  	int ret;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  353  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  354  	if (can_is_canfd_skb(skb))
1dfb6005a60b13 Vincent Mailhol 2021-04-10  355  		return -EMSGSIZE;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  356  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  357  	if (priv->tx_can_msg_cnt == 0) {
7fcecf51c18fa7 Vincent Mailhol 2021-06-29  358  		msg_len = sizeof(es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  359  		es581_4_fill_urb_header(urb_cmd, ES581_4_CAN_COMMAND_TYPE,
1dfb6005a60b13 Vincent Mailhol 2021-04-10  360  					ES581_4_CMD_ID_TX_MSG,
1dfb6005a60b13 Vincent Mailhol 2021-04-10  361  					priv->channel_idx, msg_len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  362  		es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg = 0;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  363  	} else {
1dfb6005a60b13 Vincent Mailhol 2021-04-10  364  		msg_len = es581_4_get_msg_len(urb_cmd);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  365  	}
1dfb6005a60b13 Vincent Mailhol 2021-04-10  366  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  367  	ret = es58x_check_msg_max_len(es58x_dev->dev,
1dfb6005a60b13 Vincent Mailhol 2021-04-10  368  				      es581_4_urb_cmd->bulk_tx_can_msg,
1dfb6005a60b13 Vincent Mailhol 2021-04-10  369  				      msg_len + sizeof(*tx_can_msg));
1dfb6005a60b13 Vincent Mailhol 2021-04-10  370  	if (ret)
1dfb6005a60b13 Vincent Mailhol 2021-04-10  371  		return ret;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  372  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  373  	/* Fill message contents. */
f4f5247daa45ee Vincent Mailhol 2021-06-29 @374  	tx_can_msg = (typeof(tx_can_msg))&es581_4_urb_cmd->raw_msg[msg_len];
1dfb6005a60b13 Vincent Mailhol 2021-04-10  375  	put_unaligned_le32(es58x_get_raw_can_id(cf), &tx_can_msg->can_id);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  376  	put_unaligned_le32(priv->tx_head, &tx_can_msg->packet_idx);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  377  	put_unaligned_le16((u16)es58x_get_flags(skb), &tx_can_msg->flags);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  378  	tx_can_msg->channel_no = priv->channel_idx + ES581_4_CHANNEL_IDX_OFFSET;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  379  	tx_can_msg->dlc = can_get_cc_dlc(cf, priv->can.ctrlmode);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  380  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  381  	memcpy(tx_can_msg->data, cf->data, cf->len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  382  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  383  	/* Calculate new sizes. */
1dfb6005a60b13 Vincent Mailhol 2021-04-10  384  	es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg++;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  385  	msg_len += es581_4_sizeof_rx_tx_msg(*tx_can_msg);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  386  	priv->tx_urb->transfer_buffer_length = es58x_get_urb_cmd_len(es58x_dev,
1dfb6005a60b13 Vincent Mailhol 2021-04-10  387  								     msg_len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  388  	es581_4_urb_cmd->msg_len = cpu_to_le16(msg_len);
1dfb6005a60b13 Vincent Mailhol 2021-04-10  389  
1dfb6005a60b13 Vincent Mailhol 2021-04-10  390  	return 0;
1dfb6005a60b13 Vincent Mailhol 2021-04-10  391  }
1dfb6005a60b13 Vincent Mailhol 2021-04-10  392  

:::::: The code at line 374 was first introduced by commit
:::::: f4f5247daa45eef07b1779195fa8d65f19c2eb5f can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readability

:::::: TO: Vincent Mailhol <mailhol.vincent@...adoo.fr>
:::::: CC: Marc Kleine-Budde <mkl@...gutronix.de>

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

Download attachment ".config.gz" of type "application/gzip" (38436 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ