LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [kees:kspp/array-bounds/next-20210816/v1 7/10] drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is neither array nor pointer nor vector
@ 2021-08-18 12:55 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-18 12:55 UTC (permalink / raw)
  To: Kees Cook; +Cc: kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 6004 bytes --]

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: x86_64-randconfig-a003-20210816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # 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
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

   drivers/net/can/usb/etas_es58x/es581_4.c: In function 'es581_4_tx_can_msg':
>> drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is neither array nor pointer nor vector
     374 |  tx_can_msg = (typeof(tx_can_msg))&es581_4_urb_cmd->raw_msg[msg_len];
         |                                                            ^


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@wanadoo.fr>
:::::: CC: Marc Kleine-Budde <mkl@pengutronix.de>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41253 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-18 12:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 12:55 [kees:kspp/array-bounds/next-20210816/v1 7/10] drivers/net/can/usb/etas_es58x/es581_4.c:374:60: error: subscripted value is neither array nor pointer nor vector kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).