mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
Bluetooth: btmtk: Improve BT firmware logging
The firmware log line in btmtk_setup_firmware_79xx() never says which file was requested, which matters because btmtk_fw_get_filename() derives the name from the device id and firmware version at runtime. It reports the firmware's own hwver field as the HW version, when the device id the driver read from the chip is the more useful value and is already available as dev_id. And it prints datetime, a u8[16] with no guaranteed NUL terminator, with %s. Log the filename before the image is parsed, so a file that fails validation still says which file it was, report dev_id as the HW version, and bound datetime with %.16s. The datetime change is hardening rather than a fix, hence no Fixes: tag: every file in linux-firmware terminates the field, and provoking the over-read needs a malformed file in /lib/firmware. Log output on MT7922 after the change: [ 365.245951] Bluetooth: hci0: Loading BT firmware: mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin [ 365.245956] Bluetooth: hci0: BT HW ver: 0x7922, SW ver: 0x008a, Build Time: 20260605203811 Signed-off-by: Chris Lu <chris.lu@mediatek.com> Assisted-by: Claude:claude-opus-5 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
760ac9d02d
commit
046fa20e9c
|
|
@ -214,6 +214,8 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
|
|||
return err;
|
||||
}
|
||||
|
||||
bt_dev_info(hdev, "Loading BT firmware: %s", fwname);
|
||||
|
||||
err = btmtk_fw_validate_layout(hdev, fw, §ion_num);
|
||||
if (err < 0)
|
||||
goto err_release_fw;
|
||||
|
|
@ -222,8 +224,8 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
|
|||
fw_bin_ptr = fw_ptr;
|
||||
hdr = (struct btmtk_patch_header *)fw_ptr;
|
||||
|
||||
bt_dev_info(hdev, "HW/SW Version: 0x%04x%04x, Build Time: %s",
|
||||
le16_to_cpu(hdr->hwver), le16_to_cpu(hdr->swver), hdr->datetime);
|
||||
bt_dev_info(hdev, "BT HW ver: 0x%04x, SW ver: 0x%04x, Build Time: %.16s",
|
||||
dev_id & 0xffff, le16_to_cpu(hdr->swver), hdr->datetime);
|
||||
|
||||
for (i = 0; i < section_num; i++) {
|
||||
first_block = 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user