fix warning from -Wuninitialized

This commit is contained in:
Paolo Bonzini
2011-09-21 11:59:54 +02:00
parent c940381b59
commit a1975e90f6
3 changed files with 9 additions and 1 deletions

View File

@@ -195,7 +195,8 @@ enum iscsi_header_digest {
ISCSI_HEADER_DIGEST_NONE = 0,
ISCSI_HEADER_DIGEST_NONE_CRC32C = 1,
ISCSI_HEADER_DIGEST_CRC32C_NONE = 2,
ISCSI_HEADER_DIGEST_CRC32C = 3
ISCSI_HEADER_DIGEST_CRC32C = 3,
ISCSI_HEADER_DIGEST_LAST = ISCSI_HEADER_DIGEST_CRC32C
};
/*

View File

@@ -282,6 +282,10 @@ iscsi_set_header_digest(struct iscsi_context *iscsi,
"logged in");
return -1;
}
if ((unsigned)header_digest > ISCSI_HEADER_DIGEST_LAST) {
iscsi_set_error(iscsi, "invalid header digest value");
return -1;
}
iscsi->want_header_digest = header_digest;

View File

@@ -188,6 +188,9 @@ iscsi_login_add_headerdigest(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
case ISCSI_HEADER_DIGEST_CRC32C:
str = (char *)"HeaderDigest=CRC32C";
break;
default:
iscsi_set_error(iscsi, "invalid header digest value");
return -1;
}
if (iscsi_pdu_add_data(iscsi, pdu, (unsigned char *)str, strlen(str)+1)