Change in flashrom[master]: usbdev: fix accepting shorter serial numbers than the real one.
Miklós Márton has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/34641 ) Change subject: usbdev: fix accepting shorter serial numbers than the real one. ...................................................................... usbdev: fix accepting shorter serial numbers than the real one. Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c --- M usbdev.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/41/34641/1 diff --git a/usbdev.c b/usbdev.c index 764ac04..7e41235 100644 --- a/usbdev.c +++ b/usbdev.c @@ -104,7 +104,8 @@ msg_pdbg("Serial number is %s\n", myserial); /* Filter out any serial number that does not commence with serialno */ - return 0 != strncmp(serialno, (char *)myserial, strlen(serialno)); + return strlen((char *)myserial) == strlen(serialno) + && 0 != strncmp(serialno, (char *)myserial, strlen(serialno)); } struct libusb_device_handle *usb_dev_get_by_vid_pid_serial( -- To view, visit https://review.coreboot.org/c/flashrom/+/34641 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c Gerrit-Change-Number: 34641 Gerrit-PatchSet: 1 Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-MessageType: newchange
Hello build bot (Jenkins), I'd like you to reexamine a change. Please visit https://review.coreboot.org/c/flashrom/+/34641 to look at the new patch set (#2). Change subject: usbdev: do not accept serial numbers which starting the same as expected one, but shorter ...................................................................... usbdev: do not accept serial numbers which starting the same as expected one, but shorter Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c --- M usbdev.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://review.coreboot.org:29418/flashrom refs/changes/41/34641/2 -- To view, visit https://review.coreboot.org/c/flashrom/+/34641 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c Gerrit-Change-Number: 34641 Gerrit-PatchSet: 2 Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-MessageType: newpatchset
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/34641 ) Change subject: usbdev: do not accept serial numbers which starting the same as expected one, but shorter ...................................................................... Patch Set 2: Code-Review-1 See code comment above the changed line. The current behavior is intended. The code could always be extended, though, e.g. we could issue a warning or bail ot if multiple devices match the serial prefix? -- To view, visit https://review.coreboot.org/c/flashrom/+/34641 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c Gerrit-Change-Number: 34641 Gerrit-PatchSet: 2 Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Comment-Date: Sat, 03 Aug 2019 16:29:29 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Miklós Márton has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/34641 ) Change subject: usbdev: do not accept serial numbers which starting the same as expected one, but shorter ...................................................................... Patch Set 2:
Patch Set 2: Code-Review-1
See code comment above the changed line. The current behavior is intended. The code could always be extended, though, e.g. we could issue a warning or bail ot if multiple devices match the serial prefix?
Ah, next time I will read not just code. I discovered this behaviour while tested the STLink V3 and found it strange. Which solution would you prefer? -- To view, visit https://review.coreboot.org/c/flashrom/+/34641 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c Gerrit-Change-Number: 34641 Gerrit-PatchSet: 2 Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Comment-Date: Sat, 03 Aug 2019 18:28:59 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/34641 ) Change subject: usbdev: do not accept serial numbers which starting the same as expected one, but shorter ...................................................................... Patch Set 2:
See code comment above the changed line. The current behavior is intended. The code could always be extended, though, e.g. we could issue a warning or bail ot if multiple devices match the serial prefix?
Ah, next time I will read not just code. I discovered this behaviour while tested the STLink V3 and found it strange.
Which solution would you prefer?
Bailing out if there are multiple matches, I guess. Though, that's probably hardest to implement. -- To view, visit https://review.coreboot.org/c/flashrom/+/34641 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c Gerrit-Change-Number: 34641 Gerrit-PatchSet: 2 Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net> Gerrit-Comment-Date: Sat, 03 Aug 2019 18:53:03 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: No Gerrit-MessageType: comment
Miklós Márton has abandoned this change. ( https://review.coreboot.org/c/flashrom/+/34641 ) Change subject: usbdev: do not accept serial numbers which starting the same as expected one, but shorter ...................................................................... Abandoned -- To view, visit https://review.coreboot.org/c/flashrom/+/34641 To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings Gerrit-Project: flashrom Gerrit-Branch: master Gerrit-Change-Id: Ife8c4e0a957c4345e27ec9ae9e1480ca80fe505c Gerrit-Change-Number: 34641 Gerrit-PatchSet: 2 Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Miklós Márton <martonmiklosqdev@gmail.com> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> Gerrit-CC: Paul Menzel <paulepanter@mailbox.org> Gerrit-MessageType: abandon
participants (2)
-
Miklós Márton (Code Review) -
Nico Huber (Code Review)