aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-22 10:25:22 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-22 10:25:22 +0200
commit65270533bc0de850e9722d09e54da6569afc2b36 (patch)
tree2f059244f59d9bc44fdbe6847b0c2303cbff9a4b
parent1ab369e80c6c313c15218f0b55174a81a8a82d19 (diff)
v4l2-dbg: fix control flow problem
Fix this coverity report: *** CID 1452658: Control flow issues (NO_EFFECT) /utils/v4l2-dbg/v4l2-dbg.cpp: 567 in main() 561 if (doioctl(fd, VIDIOC_DBG_G_CHIP_INFO, &chip_info, "VIDIOC_DBG_G_CHIP_INFO") != 0) 562 chip_info.name[0] = '\0'; 563 564 if (!strncasecmp(match.name, "ac97", 4)) { 565 curr_bd = &boards[AC97_BOARD]; 566 } else { >>> >>> CID 1452658: Control flow issues (NO_EFFECT) >>> >>> This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "board >= 0UL". 567 for (size_t board = boards.size() - 1; board >= 0; board--) { 568 if (!strcasecmp(chip_info.name, boards[board].name)) { 569 curr_bd = &boards[board]; 570 break; 571 } 572 } Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: bafe32e7 ("v4l-utils: convert board_list to vector")
-rw-r--r--utils/v4l2-dbg/v4l2-dbg.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 0873c268..47b1263c 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -564,9 +564,9 @@ int main(int argc, char **argv)
if (!strncasecmp(match.name, "ac97", 4)) {
curr_bd = &boards[AC97_BOARD];
} else {
- for (size_t board = boards.size() - 1; board >= 0; board--) {
- if (!strcasecmp(chip_info.name, boards[board].name)) {
- curr_bd = &boards[board];
+ for (size_t board = boards.size(); board; board--) {
+ if (!strcasecmp(chip_info.name, boards[board - 1].name)) {
+ curr_bd = &boards[board - 1];
break;
}
}

Privacy Policy