When len == 0 nread can have an uninitialized value that gets used. Initialize it. Note that zero-length reads happen when there's nothing in the checkpoint header except the type and len fields. This means the first read is sizeof(ckpt_hdr) and the second, "payload", read is zero length. Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx> --- ckptinfo.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ckptinfo.c b/ckptinfo.c index d73b38c..23db9fb 100644 --- a/ckptinfo.c +++ b/ckptinfo.c @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) static int __image_read(int fd, void *buf, int len) { - ssize_t nread; + ssize_t nread = 0; int nleft; for (nleft = len; nleft; nleft -= nread) { -- 1.6.3.3 _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers