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>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 13 Aug 2022 03:19:59 +0800
From:   kernel test robot <lkp@...el.com>
To:     Manish Mandlik <mmandlik@...gle.com>,
        Arend van Spriel <aspriel@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        marcel@...tmann.org, luiz.dentz@...il.com
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        Johannes Berg <johannes@...solutions.net>,
        Dan Williams <dan.j.williams@...el.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        "Signed-off-by : Manish Mandlik" <mmandlik@...gle.com>,
        linux-bluetooth@...r.kernel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        chromeos-bluetooth-upstreaming@...omium.org,
        Won Chung <wonchung@...gle.com>,
        Abhishek Pandit-Subedi <abhishekpandit@...omium.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH v5 3/5] Bluetooth: Add support for hci devcoredump

Hi Manish,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master driver-core/driver-core-testing linus/master next-20220812]
[cannot apply to v5.19]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Manish-Mandlik/sysfs-Add-attribute-info-for-sys-devices-coredump_disabled/20220811-000313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
config: x86_64-randconfig-a003 (https://download.01.org/0day-ci/archive/20220813/202208130346.2UmF05bO-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
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://github.com/intel-lab-lkp/linux/commit/6fe2192077ebdca91aef91e907f79d9e38960a21
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manish-Mandlik/sysfs-Add-attribute-info-for-sys-devices-coredump_disabled/20220811-000313
        git checkout 6fe2192077ebdca91aef91e907f79d9e38960a21
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/bluetooth/

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

All warnings (new ones prefixed by >>):

>> net/bluetooth/coredump.c:301:20: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                                       dump_size, hdev->dump.alloc_size);
                                                  ^~~~~~~~~~~~~~~~~~~~~
   include/net/bluetooth/bluetooth.h:255:43: note: expanded from macro 'bt_dev_info'
           BT_INFO("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
                          ~~~                       ^~~~~~~~~~~
   include/net/bluetooth/bluetooth.h:242:47: note: expanded from macro 'BT_INFO'
   #define BT_INFO(fmt, ...)       bt_info(fmt "\n", ##__VA_ARGS__)
                                           ~~~         ^~~~~~~~~~~
   net/bluetooth/coredump.c:320:20: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                                       dump_size, hdev->dump.alloc_size);
                                                  ^~~~~~~~~~~~~~~~~~~~~
   include/net/bluetooth/bluetooth.h:255:43: note: expanded from macro 'bt_dev_info'
           BT_INFO("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
                          ~~~                       ^~~~~~~~~~~
   include/net/bluetooth/bluetooth.h:242:47: note: expanded from macro 'BT_INFO'
   #define BT_INFO(fmt, ...)       bt_info(fmt "\n", ##__VA_ARGS__)
                                           ~~~         ^~~~~~~~~~~
   net/bluetooth/coredump.c:365:18: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                       dump_size, hdev->dump.alloc_size);
                                  ^~~~~~~~~~~~~~~~~~~~~
   include/net/bluetooth/bluetooth.h:255:43: note: expanded from macro 'bt_dev_info'
           BT_INFO("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
                          ~~~                       ^~~~~~~~~~~
   include/net/bluetooth/bluetooth.h:242:47: note: expanded from macro 'BT_INFO'
   #define BT_INFO(fmt, ...)       bt_info(fmt "\n", ##__VA_ARGS__)
                                           ~~~         ^~~~~~~~~~~
   3 warnings generated.


vim +301 net/bluetooth/coredump.c

   182	
   183	/* Bluetooth devcoredump state machine.
   184	 *
   185	 * Devcoredump states:
   186	 *
   187	 *      HCI_DEVCOREDUMP_IDLE: The default state.
   188	 *
   189	 *      HCI_DEVCOREDUMP_ACTIVE: A devcoredump will be in this state once it has
   190	 *              been initialized using hci_devcoredump_init(). Once active, the
   191	 *              driver can append data using hci_devcoredump_append() or insert
   192	 *              a pattern using hci_devcoredump_append_pattern().
   193	 *
   194	 *      HCI_DEVCOREDUMP_DONE: Once the dump collection is complete, the drive
   195	 *              can signal the completion using hci_devcoredump_complete(). A
   196	 *              devcoredump is generated indicating the completion event and
   197	 *              then the state machine is reset to the default state.
   198	 *
   199	 *      HCI_DEVCOREDUMP_ABORT: The driver can cancel ongoing dump collection in
   200	 *              case of any error using hci_devcoredump_abort(). A devcoredump
   201	 *              is still generated with the available data indicating the abort
   202	 *              event and then the state machine is reset to the default state.
   203	 *
   204	 *      HCI_DEVCOREDUMP_TIMEOUT: A timeout timer for HCI_DEVCOREDUMP_TIMEOUT sec
   205	 *              is started during devcoredump initialization. Once the timeout
   206	 *              occurs, the driver is notified, a devcoredump is generated with
   207	 *              the available data indicating the timeout event and then the
   208	 *              state machine is reset to the default state.
   209	 *
   210	 * The driver must register using hci_devcoredump_register() before using the
   211	 * hci devcoredump APIs.
   212	 */
   213	void hci_devcoredump_rx(struct work_struct *work)
   214	{
   215		struct hci_dev *hdev = container_of(work, struct hci_dev, dump.dump_rx);
   216		struct sk_buff *skb;
   217		struct hci_devcoredump_skb_pattern *pattern;
   218		u32 dump_size;
   219		int start_state;
   220	
   221	#define DBG_UNEXPECTED_STATE() \
   222			bt_dev_dbg(hdev, \
   223				   "Unexpected packet (%d) for state (%d). ", \
   224				   hci_dmp_cb(skb)->pkt_type, hdev->dump.state)
   225	
   226		while ((skb = skb_dequeue(&hdev->dump.dump_q))) {
   227			hci_dev_lock(hdev);
   228			start_state = hdev->dump.state;
   229	
   230			switch (hci_dmp_cb(skb)->pkt_type) {
   231			case HCI_DEVCOREDUMP_PKT_INIT:
   232				if (hdev->dump.state != HCI_DEVCOREDUMP_IDLE) {
   233					DBG_UNEXPECTED_STATE();
   234					goto loop_continue;
   235				}
   236	
   237				if (skb->len != sizeof(dump_size)) {
   238					bt_dev_dbg(hdev, "Invalid dump init pkt");
   239					goto loop_continue;
   240				}
   241	
   242				dump_size = *((u32 *)skb->data);
   243				if (!dump_size) {
   244					bt_dev_err(hdev, "Zero size dump init pkt");
   245					goto loop_continue;
   246				}
   247	
   248				if (hci_devcoredump_prepare(hdev, dump_size)) {
   249					bt_dev_err(hdev, "Failed to prepare for dump");
   250					goto loop_continue;
   251				}
   252	
   253				hci_devcoredump_update_state(hdev,
   254							     HCI_DEVCOREDUMP_ACTIVE);
   255				queue_delayed_work(hdev->workqueue,
   256						   &hdev->dump.dump_timeout,
   257						   DEVCOREDUMP_TIMEOUT);
   258				break;
   259	
   260			case HCI_DEVCOREDUMP_PKT_SKB:
   261				if (hdev->dump.state != HCI_DEVCOREDUMP_ACTIVE) {
   262					DBG_UNEXPECTED_STATE();
   263					goto loop_continue;
   264				}
   265	
   266				if (!hci_devcoredump_copy(hdev, skb->data, skb->len))
   267					bt_dev_dbg(hdev, "Failed to insert skb");
   268				break;
   269	
   270			case HCI_DEVCOREDUMP_PKT_PATTERN:
   271				if (hdev->dump.state != HCI_DEVCOREDUMP_ACTIVE) {
   272					DBG_UNEXPECTED_STATE();
   273					goto loop_continue;
   274				}
   275	
   276				if (skb->len != sizeof(*pattern)) {
   277					bt_dev_dbg(hdev, "Invalid pattern skb");
   278					goto loop_continue;
   279				}
   280	
   281				pattern = (void *)skb->data;
   282	
   283				if (!hci_devcoredump_memset(hdev, pattern->pattern,
   284							    pattern->len))
   285					bt_dev_dbg(hdev, "Failed to set pattern");
   286				break;
   287	
   288			case HCI_DEVCOREDUMP_PKT_COMPLETE:
   289				if (hdev->dump.state != HCI_DEVCOREDUMP_ACTIVE) {
   290					DBG_UNEXPECTED_STATE();
   291					goto loop_continue;
   292				}
   293	
   294				hci_devcoredump_update_state(hdev,
   295							     HCI_DEVCOREDUMP_DONE);
   296				dump_size = hdev->dump.tail - hdev->dump.head;
   297	
   298				bt_dev_info(hdev,
   299					    "Devcoredump complete with size %u "
   300					    "(expect %u)",
 > 301					    dump_size, hdev->dump.alloc_size);
   302	
   303				dev_coredumpv(&hdev->dev, hdev->dump.head, dump_size,
   304					      GFP_KERNEL);
   305				break;
   306	
   307			case HCI_DEVCOREDUMP_PKT_ABORT:
   308				if (hdev->dump.state != HCI_DEVCOREDUMP_ACTIVE) {
   309					DBG_UNEXPECTED_STATE();
   310					goto loop_continue;
   311				}
   312	
   313				hci_devcoredump_update_state(hdev,
   314							     HCI_DEVCOREDUMP_ABORT);
   315				dump_size = hdev->dump.tail - hdev->dump.head;
   316	
   317				bt_dev_info(hdev,
   318					    "Devcoredump aborted with size %u "
   319					    "(expect %u)",
   320					    dump_size, hdev->dump.alloc_size);
   321	
   322				/* Emit a devcoredump with the available data */
   323				dev_coredumpv(&hdev->dev, hdev->dump.head, dump_size,
   324					      GFP_KERNEL);
   325				break;
   326	
   327			default:
   328				bt_dev_dbg(hdev,
   329					   "Unknown packet (%d) for state (%d). ",
   330					   hci_dmp_cb(skb)->pkt_type, hdev->dump.state);
   331				break;
   332			}
   333	
   334	loop_continue:
   335			kfree_skb(skb);
   336			hci_dev_unlock(hdev);
   337	
   338			if (start_state != hdev->dump.state)
   339				hci_devcoredump_notify(hdev, hdev->dump.state);
   340	
   341			hci_dev_lock(hdev);
   342			if (hdev->dump.state == HCI_DEVCOREDUMP_DONE ||
   343			    hdev->dump.state == HCI_DEVCOREDUMP_ABORT)
   344				hci_devcoredump_reset(hdev);
   345			hci_dev_unlock(hdev);
   346		}
   347	}
   348	EXPORT_SYMBOL(hci_devcoredump_rx);
   349	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ