Project

General

Profile

Actions

Bug #3060

closed

sys/boot/common/module.c:247: logical fault ?

Added by dcb over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
09/18/2017
Due date:
% Done:

0%

Estimated time:

Description

dragonfly/sys/boot/common/module.c:247] -> [dragonfly/sys/boot/common/module.c:254]: (warning) Identical condition 'got==0', second condition is always false

Source code is

got = read(fd, buf, 8192);
if (got 0)
break;
if (got < 0) {
printf("error reading '%s': %s\n",
name, strerror(errno));
break;
}
if (got 0)
crc = iscsi_crc32(buf, got);
else
crc = iscsi_crc32_ext(buf, got, crc);

So it looks like the crc code is never executed.

Actions #1

Updated by lubos over 6 years ago

I think the second condition should be checking `crc' instead, like this:

diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c
index 449e64d..24ff89e 100644
--- a/sys/boot/common/module.c
++ b/sys/boot/common/module.c
@ -251,7 +251,7 @ command_crc(int argc, char *argv[])
name, strerror(errno));
break;
}
- if (got 0)
if (crc 0)
crc = iscsi_crc32(buf, got);
else
crc = iscsi_crc32_ext(buf, got, crc);

Actions #2

Updated by swildner over 6 years ago

  • Status changed from New to Closed

Fix pushed, thanks!

Actions

Also available in: Atom PDF