Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2089259rwb; Thu, 19 Jan 2023 20:54:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXuLKryBw9AGvMqL82rlhIEAPhk8mjchQZQ31Hi0+XIK/AV99oXhy/7tPK7JUL1jR2w1s+tF X-Received: by 2002:a17:906:644f:b0:877:6549:bb6 with SMTP id l15-20020a170906644f00b0087765490bb6mr8030986ejn.58.1674190472718; Thu, 19 Jan 2023 20:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674190472; cv=none; d=google.com; s=arc-20160816; b=dfCr/+6+v4AbogQSyREhDNfOXnv78dLA+ZyD2fVkFkWEwwQ8DAPzkTOj+B0RgohOgV ayLWb73AEL3KrQbIdLg1bVHr57RPE59mVc8atBC9ZZhmdj4sPb/0ugLDFOGCZ2ct2TSm 3Sn1qCr7jPFwzt43xGf+Hmj+T5bQ6PBqPAzYH3xMMXx+sPRLT1Nh17qO3zWjuLADDKHz +U4D3nwfOWCJo+4no7wDlMMsPczM6PGo5faVNCOUY48G5XegwJm/e4ZBMBs4MVoOgnV3 rsUJsiBk9se+So0BFwaP2Uqwyzq0leay3MJNXbsy+jxArrog5RjXFQH4fPI43ic1MvXS mg3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Bl3cN35AF+gH9+dprh+e8wwnzSP3vote9ZgAsiZKBXs=; b=uC5UCkInTNrx/30YJINNoN8kHrI1FFFOYu5M/y+EPfRllTB8wOo64s3ms1lz8FgnrB 3PAIHiA87W2lWr0QeAs3K2OrzZwbMefiS2KCNB15sHwxcMrROFuEYGKG4ElQAXdUTslC tbkb8L4XyU2LNHEdPgWf3C20pSKmCvgiOkCKj0q1npOhN0zk3jy5dyacSUDymDCx6Dco W58DLCe5Wcl/6nqEYIk3XToUHrTA3xH10okc0A+osoFF+mXIMw/SSfNFwov7ahhhi5Je CRdO3i2lhr+Q/hgSgbb9l/JzmKVfQILTeHqQRHGQ8BgfQjHiH7u+KbzEf6RGpcHlBdAx Ca1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Phc0v43d; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg7-20020a1709072cc700b008692b15cca1si24412823ejc.603.2023.01.19.20.53.59; Thu, 19 Jan 2023 20:54:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Phc0v43d; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbjATEx0 (ORCPT + 99 others); Thu, 19 Jan 2023 23:53:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjATExG (ORCPT ); Thu, 19 Jan 2023 23:53:06 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829B561AE; Thu, 19 Jan 2023 20:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674189897; x=1705725897; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=S201eruROP7eKPTKXbHcEhpKDU2DfgLuA341gnj3670=; b=Phc0v43dzjW5f/Ry4Y1bJ5baa4MyxOULvrWbWWZaDdHRlIHTRu+vePlQ 7+3HJLLNxsXV0okeYtmtu/pxmgl7ZxFw6gW2LfZyyM5dNxAgR8Cl9V/Nj Oj59uOXKpB5GE9vcCxi8AtthSkHycsVAsERwHCLE5WzDiiJ2JZxr76uhr apZT/Sll8+zYG1AeTWVrrC4xPQSUDDE9xD4ofQuAuHMs/vy+H8VaUjieK 7s1IpriIWgKy0od7i73DGnBISMxsBy5FpVGOpkUbermomvofTI/Wn3ouh YW35+a9DFuVme9SiUtVWno9XZzsH+GOI8Ev4wji92Nw6AvlxeU8AOijpB w==; X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="387700170" X-IronPort-AV: E=Sophos;i="5.97,229,1669104000"; d="scan'208";a="387700170" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2023 08:22:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10595"; a="690677479" X-IronPort-AV: E=Sophos;i="5.97,229,1669104000"; d="scan'208";a="690677479" Received: from lkp-server01.sh.intel.com (HELO 5646d64e7320) ([10.239.97.150]) by orsmga008.jf.intel.com with ESMTP; 19 Jan 2023 08:21:59 -0800 Received: from kbuild by 5646d64e7320 with local (Exim 4.96) (envelope-from ) id 1pIXfr-0001cm-09; Thu, 19 Jan 2023 16:21:59 +0000 Date: Fri, 20 Jan 2023 00:21:36 +0800 From: kernel test robot To: max.chou@realtek.com, marcel@holtmann.org Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, alex_lu@realsil.com.cn, hildawu@realtek.com, max.chou@realtek.com, allen_chen@realsil.com.cn Subject: Re: [PATCH 1/1] Bluetooth: btrtl: Firmware format v2 support Message-ID: <202301200026.jbRDhsXX-lkp@intel.com> References: <20230119074714.156283-1-max.chou@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230119074714.156283-1-max.chou@realtek.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bluetooth/master] [also build test WARNING on bluetooth-next/master linus/master v6.2-rc4 next-20230119] [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/max-chou-realtek-com/Bluetooth-btrtl-Firmware-format-v2-support/20230119-155205 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master patch link: https://lore.kernel.org/r/20230119074714.156283-1-max.chou%40realtek.com patch subject: [PATCH 1/1] Bluetooth: btrtl: Firmware format v2 support config: x86_64-randconfig-a003 (https://download.01.org/0day-ci/archive/20230120/202301200026.jbRDhsXX-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) 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/ffdaef9bef66fbba642b544b0a1f35217dc17d6a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review max-chou-realtek-com/Bluetooth-btrtl-Firmware-format-v2-support/20230119-155205 git checkout ffdaef9bef66fbba642b544b0a1f35217dc17d6a # 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 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/bluetooth/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/bluetooth/btrtl.c:430:6: warning: variable 'dummy' set but not used [-Wunused-but-set-variable] int dummy = 0; ^ >> drivers/bluetooth/btrtl.c:429:6: warning: variable 'secure' set but not used [-Wunused-but-set-variable] int secure = 0; ^ 2 warnings generated. vim +/dummy +430 drivers/bluetooth/btrtl.c 413 414 static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, 415 struct btrtl_device_info *btrtl_dev, 416 unsigned char **_buf) 417 { 418 struct rtl_epatch_header_v2 *hdr; 419 int rc; 420 u8 reg_val[2]; 421 u8 key_id; 422 u32 num_sections; 423 struct rtl_section *section; 424 struct rtl_subsection *entry, *tmp; 425 u32 section_len; 426 u32 opcode; 427 int len = 0; 428 int i; > 429 int secure = 0; > 430 int dummy = 0; 431 u8 *ptr; 432 /* Cut the tail of the firmware. */ 433 u8 *end = btrtl_dev->fw_data + btrtl_dev->fw_len - 7; 434 435 rc = btrtl_vendor_read_reg16(hdev, RTL_SEC_PROJ, reg_val); 436 if (rc < 0) 437 return -EIO; 438 439 key_id = reg_val[0]; 440 rtl_dev_dbg(hdev, "%s: key id %u", __func__, key_id); 441 btrtl_dev->key_id = key_id; 442 443 hdr = (struct rtl_epatch_header_v2 *)btrtl_dev->fw_data; 444 num_sections = le32_to_cpu(hdr->num_sections); 445 446 rtl_dev_dbg(hdev, "FW version %08x-%08x", *((u32 *)hdr->fw_version), 447 *((u32 *)(hdr->fw_version + 4))); 448 449 ptr = btrtl_dev->fw_data + sizeof(*hdr); 450 for (i = 0; i < num_sections; i++) { 451 section = (void *)ptr; 452 if (ptr + sizeof(*section) > end) 453 break; 454 ptr += sizeof(*section); 455 456 section_len = le32_to_cpu(section->len); 457 if (ptr + section_len > end) 458 break; 459 ptr += section_len; 460 } 461 462 if (i < num_sections) 463 return -EOVERFLOW; 464 465 ptr = btrtl_dev->fw_data + sizeof(*hdr); 466 for (i = 0; i < num_sections; i++) { 467 section = (void *)ptr; 468 rtl_dev_dbg(hdev, "opcode 0x%04x", section->opcode); 469 ptr += sizeof(*section); 470 471 section_len = le32_to_cpu(section->len); 472 opcode = le32_to_cpu(section->opcode); 473 switch (opcode) { 474 case RTL_PATCH_SNIPPETS: 475 rc = btrtl_parse_section(hdev, btrtl_dev, opcode, ptr, 476 section_len); 477 break; 478 case RTL_PATCH_SECURITY_HEADER: 479 /* If key_id from chip is zero, ignore all security 480 * headers. 481 */ 482 if (!key_id) 483 break; 484 rc = btrtl_parse_section(hdev, btrtl_dev, opcode, ptr, 485 section_len); 486 if (rc > 0) 487 secure += rc; 488 489 break; 490 case RTL_PATCH_DUMMY_HEADER: 491 if (key_id) 492 break; 493 rc = btrtl_parse_section(hdev, btrtl_dev, opcode, ptr, 494 section_len); 495 if (rc > 0) 496 dummy += rc; 497 break; 498 default: 499 rc = 0; 500 break; 501 } 502 if (rc < 0) { 503 rtl_dev_err(hdev, "RTL: Parse section (%u) err %d", 504 opcode, rc); 505 return rc; 506 } 507 len += rc; 508 ptr += section_len; 509 } 510 511 if (!len) 512 return -ENODATA; 513 514 bt_dev_info(hdev, "RTL: Patch (len %d) found", len); 515 516 /* Allocate mem and copy all found subsecs. */ 517 ptr = kvmalloc(len, GFP_KERNEL); 518 if (!ptr) 519 return -ENOMEM; 520 521 len = 0; 522 list_for_each_entry_safe(entry, tmp, &btrtl_dev->patch_subsecs, list) { 523 rtl_dev_dbg(hdev, "RTL: len 0x%x", entry->len); 524 memcpy(ptr + len, entry->data, entry->len); 525 len += entry->len; 526 list_del(&entry->list); 527 kfree(entry); 528 } 529 530 *_buf = ptr; 531 return len; 532 } 533 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests