From: Joe Guo Date: Wed, 19 Dec 2018 01:37:33 +0000 (+1300) Subject: samba-o3: fix -Werror=strict-overflow error in s4/torture/raw/eas module X-Git-Tag: talloc-2.2.0~135 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16d40ffcf04a0c3c7dd8699cf7980ed1fb32612a;p=thirdparty%2Fsamba.git samba-o3: fix -Werror=strict-overflow error in s4/torture/raw/eas module samba-o3 test failed in ubuntu:16.04 docker container: ==> /home/samba/samba/samba-o3.stderr <== ../../source4/torture/raw/eas.c: In function ‘test_max_eas’: ../../source4/torture/raw/eas.c:286:12: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx) ^ cc1: all warnings being treated as errors `total += j` may overflow. Change total type to `size_t` to mute error. Signed-off-by: Joe Guo Reviewed-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index eace20ae83a..59baae53ad6 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -292,7 +292,8 @@ static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx) bool ret = true; bool err = false; - int i, j, k, last, total; + int i, j, k, last; + size_t total; DATA_BLOB eablob; char *eaname = NULL; int maxeasize; @@ -398,7 +399,7 @@ static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx) last = j; } - torture_comment(tctx, "Total EA size:%d\n", total); + torture_comment(tctx, "Total EA size:%zu\n", total); if (i == maxeanames) { torture_comment(tctx, "NOTE: More EAs could be available!\n"); }