[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202203091200.HA9qx4ka-lkp@intel.com>
Date: Wed, 9 Mar 2022 12:16:43 +0800
From: kernel test robot <lkp@...el.com>
To: Balakrishna Godavarthi <bgodavar@...eaurora.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Marcel Holtmann <marcel@...tmann.org>,
Venkata Lakshmi Narayana Gubba <gubbaven@...eaurora.org>
Subject: drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to
restricted __le16
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 92f90cc9fe0e7a984ea3d4bf3d120e30ba8a2118
commit: d841502c79e3fda2ba0e8d64f9eb00e9dd884af0 Bluetooth: hci_qca: Collect controller memory dump during SSR
date: 2 years, 2 months ago
config: parisc-randconfig-s031-20220212 (https://download.01.org/0day-ci/archive/20220309/202203091200.HA9qx4ka-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d841502c79e3fda2ba0e8d64f9eb00e9dd884af0
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d841502c79e3fda2ba0e8d64f9eb00e9dd884af0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
drivers/bluetooth/hci_qca.c: note: in included file (through arch/parisc/include/uapi/asm/unistd.h, arch/parisc/include/asm/unistd.h, include/uapi/linux/unistd.h, ...):
./arch/parisc/include/generated/uapi/asm/unistd_32.h:380:41: sparse: sparse: no newline at end of file
>> drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to restricted __le16
>> drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to restricted __le16
>> drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to restricted __le16
>> drivers/bluetooth/hci_qca.c:996:26: sparse: sparse: cast to restricted __le16
drivers/bluetooth/hci_qca.c:997:26: sparse: sparse: cast to restricted __le16
drivers/bluetooth/hci_qca.c:997:26: sparse: sparse: cast to restricted __le16
drivers/bluetooth/hci_qca.c:997:26: sparse: sparse: cast to restricted __le16
drivers/bluetooth/hci_qca.c:997:26: sparse: sparse: cast to restricted __le16
>> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted __le32
>> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted __le32
>> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted __le32
>> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted __le32
>> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted __le32
>> drivers/bluetooth/hci_qca.c:1011:37: sparse: sparse: cast to restricted __le32
drivers/bluetooth/hci_qca.c:1078:5: sparse: sparse: symbol 'qca_controller_memdump_event' was not declared. Should it be static?
vim +996 drivers/bluetooth/hci_qca.c
968
969 static void qca_controller_memdump(struct work_struct *work)
970 {
971 struct qca_data *qca = container_of(work, struct qca_data,
972 ctrl_memdump_evt);
973 struct hci_uart *hu = qca->hu;
974 struct sk_buff *skb;
975 struct qca_memdump_event_hdr *cmd_hdr;
976 struct qca_memdump_data *qca_memdump = qca->qca_memdump;
977 struct qca_dump_size *dump;
978 char *memdump_buf;
979 char nullBuff[QCA_DUMP_PACKET_SIZE] = { 0 };
980 u16 opcode, seq_no;
981 u32 dump_size;
982
983 while ((skb = skb_dequeue(&qca->rx_memdump_q))) {
984
985 if (!qca_memdump) {
986 qca_memdump = kzalloc(sizeof(struct qca_memdump_data),
987 GFP_ATOMIC);
988 if (!qca_memdump)
989 return;
990
991 qca->qca_memdump = qca_memdump;
992 }
993
994 qca->memdump_state = QCA_MEMDUMP_COLLECTING;
995 cmd_hdr = (void *) skb->data;
> 996 opcode = __le16_to_cpu(cmd_hdr->opcode);
997 seq_no = __le16_to_cpu(cmd_hdr->seq_no);
998 skb_pull(skb, sizeof(struct qca_memdump_event_hdr));
999
1000 if (!seq_no) {
1001
1002 /* This is the first frame of memdump packet from
1003 * the controller, Disable IBS to recevie dump
1004 * with out any interruption, ideally time required for
1005 * the controller to send the dump is 8 seconds. let us
1006 * start timer to handle this asynchronous activity.
1007 */
1008 clear_bit(QCA_IBS_ENABLED, &qca->flags);
1009 set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags);
1010 dump = (void *) skb->data;
> 1011 dump_size = __le32_to_cpu(dump->dump_size);
1012 if (!(dump_size)) {
1013 bt_dev_err(hu->hdev, "Rx invalid memdump size");
1014 kfree_skb(skb);
1015 return;
1016 }
1017
1018 bt_dev_info(hu->hdev, "QCA collecting dump of size:%u",
1019 dump_size);
1020 mod_timer(&qca->memdump_timer, (jiffies +
1021 msecs_to_jiffies(MEMDUMP_TIMEOUT_MS)));
1022
1023 skb_pull(skb, sizeof(dump_size));
1024 memdump_buf = vmalloc(dump_size);
1025 qca_memdump->memdump_buf_head = memdump_buf;
1026 qca_memdump->memdump_buf_tail = memdump_buf;
1027 }
1028
1029 memdump_buf = qca_memdump->memdump_buf_tail;
1030
1031 /* If sequence no 0 is missed then there is no point in
1032 * accepting the other sequences.
1033 */
1034 if (!memdump_buf) {
1035 bt_dev_err(hu->hdev, "QCA: Discarding other packets");
1036 kfree(qca_memdump);
1037 kfree_skb(skb);
1038 qca->qca_memdump = NULL;
1039 return;
1040 }
1041
1042 /* There could be chance of missing some packets from
1043 * the controller. In such cases let us store the dummy
1044 * packets in the buffer.
1045 */
1046 while ((seq_no > qca_memdump->current_seq_no + 1) &&
1047 seq_no != QCA_LAST_SEQUENCE_NUM) {
1048 bt_dev_err(hu->hdev, "QCA controller missed packet:%d",
1049 qca_memdump->current_seq_no);
1050 memcpy(memdump_buf, nullBuff, QCA_DUMP_PACKET_SIZE);
1051 memdump_buf = memdump_buf + QCA_DUMP_PACKET_SIZE;
1052 qca_memdump->received_dump += QCA_DUMP_PACKET_SIZE;
1053 qca_memdump->current_seq_no++;
1054 }
1055
1056 memcpy(memdump_buf, (unsigned char *) skb->data, skb->len);
1057 memdump_buf = memdump_buf + skb->len;
1058 qca_memdump->memdump_buf_tail = memdump_buf;
1059 qca_memdump->current_seq_no = seq_no + 1;
1060 qca_memdump->received_dump += skb->len;
1061 qca->qca_memdump = qca_memdump;
1062 kfree_skb(skb);
1063 if (seq_no == QCA_LAST_SEQUENCE_NUM) {
1064 bt_dev_info(hu->hdev, "QCA writing crash dump of size %d bytes",
1065 qca_memdump->received_dump);
1066 memdump_buf = qca_memdump->memdump_buf_head;
1067 dev_coredumpv(&hu->serdev->dev, memdump_buf,
1068 qca_memdump->received_dump, GFP_KERNEL);
1069 del_timer(&qca->memdump_timer);
1070 kfree(qca->qca_memdump);
1071 qca->qca_memdump = NULL;
1072 qca->memdump_state = QCA_MEMDUMP_COLLECTED;
1073 }
1074 }
1075
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists