From ac067bde67c2e200120380b1e0e093e6bae01e69 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 4 Feb 2013 17:25:38 +0300 Subject: [PATCH] overflow: fix false positive allocating a void pointer For a void pointer the bytes is -1. Also if it says we are allocating a negative number of bytes that's probably bogus. Treat it as a large positive by using sval.uvalue instead of sval.value. Signed-off-by: Dan Carpenter --- check_overflow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_overflow.c b/check_overflow.c index ee4ed316..a0de2e5e 100644 --- a/check_overflow.c +++ b/check_overflow.c @@ -320,9 +320,9 @@ static void db_returns_buf_size(struct expression *expr, int param, char *unused if (!type) return; bytes = bits_to_bytes(type->bit_size); - if (!bytes) + if (bytes <= 0) return; - if (sval.value >= bytes) + if (sval.uvalue >= bytes) return; sm_msg("error: not allocating enough data %d vs %s", bytes, sval_to_str(sval)); } -- 2.11.4.GIT