usb: delete impossible-to-reach code
What changed, and why it matters
This commit removes four lines of code from the USB mass-storage handling task. The deleted branch checked for two event flags that the surrounding logic already handles earlier, so it could never actually run. There is no indication this change fixes a security bug; it is a routine cleanup of dead code.
No security action required. Treat as normal code-quality/maintenance cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In main/usbhmsc/usbhmsc.c, the usbstorage_task loop had a conditional chain checking event bits. The removed else if (ebt & (DEVICE_CONNECTED | HOST_ALL_FREE)) branch is unreachable because the preceding if (ebt & DEVICE_CONNECTED) branch already consumes the DEVICE_CONNECTED case, and HOST_ALL_FREE is handled by an earlier if (ebt & HOST_ALL_FREE) block. The commit therefore deletes impossible-to-reach code. No security-relevant behavior change is evident from the diff.
Changed components
main/usbhmsc/usbhmsc.cusbstorage_taskInspect captured patch +0 / −4
diff --git a/main/usbhmsc/usbhmsc.c b/main/usbhmsc/usbhmsc.c
index d4efa7a..9e0b65c 100644
--- a/main/usbhmsc/usbhmsc.c
+++ b/main/usbhmsc/usbhmsc.c
@@ -213,10 +213,6 @@ static void usbstorage_task(void* ignore)
trigger_event(USBSTORAGE_EVENT_ABNORMALLY_EJECTED, device_address);
done = !usbstorage_is_enabled;
break;
- } else if (ebt & (DEVICE_CONNECTED | HOST_ALL_FREE)) {
- trigger_event(USBSTORAGE_EVENT_EJECTED, device_address);
- done = !usbstorage_is_enabled;
- break;
} else if (!ebt && requires_host_uninstall && !usb_device_installed) {
// Stop powering any connected usb device to trigger detach events
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.