These have been around for quite some time. gcc -DHAVE_CONFIG_H -I. -Wall -Wextra -g -O2 -MT asn1.o -MD -MP -MF .deps/asn1.Tpo -c -o asn1.o asn1.c asn1.c: In function ‘asn1_write’: asn1.c:45:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] asn1.c: In function ‘asn1_peek’: asn1.c:411:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] asn1.c: In function ‘asn1_tag_remaining’: asn1.c:541:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] asn1.c: In function ‘_ber_read_OID_String_impl’: asn1.c:570:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Almost all of these are due to the fact that asn1_data->ofs is a signed value, and ->length is unsigned. In most cases, I've fixed it by casting ofs to an unsigned value, but in one case, I cast length to a signed value since it looked possible for the result to go negative. Hopefully the values here will always be small enough that this is never a real problem. This should clear the way to add -Werror to the cflags in the near future. Signed-off-by: Jeff Layton <jlayton@xxxxxxxxx> --- asn1.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/asn1.c b/asn1.c index 4103419..34475b6 100644 --- a/asn1.c +++ b/asn1.c @@ -41,8 +41,9 @@ void asn1_free(struct asn1_data *data) /* write to the ASN1 buffer, advancing the buffer pointer */ bool asn1_write(struct asn1_data *data, const void *p, int len) { - if (data->has_error) return false; - if (data->length < data->ofs+len) { + if (data->has_error) + return false; + if (data->length < (size_t)data->ofs + len) { uint8_t *newp; newp = talloc_realloc(data, data->data, uint8_t, data->ofs+len); if (!newp) { @@ -408,7 +409,7 @@ bool asn1_peek(struct asn1_data *data, void *p, int len) if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len) return false; - if (data->ofs + len > data->length) { + if ((size_t)data->ofs + len > data->length) { /* we need to mark the buffer as consumed, so the caller knows this was an out of data error, and not a decode error */ data->ofs = data->length; @@ -538,7 +539,7 @@ int asn1_tag_remaining(struct asn1_data *data) return -1; } remaining = data->nesting->taglen - (data->ofs - data->nesting->start); - if (remaining > (data->length - data->ofs)) { + if (remaining > (ssize_t)data->length - data->ofs) { data->has_error = true; return -1; } @@ -553,7 +554,7 @@ int asn1_tag_remaining(struct asn1_data *data) static bool _ber_read_OID_String_impl(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID, size_t *bytes_eaten) { - int i; + unsigned int i; uint8_t *b; unsigned int v; char *tmp_oid = NULL; -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html