From: Noel Power Date: Wed, 22 May 2019 11:29:33 +0000 (+0000) Subject: s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error X-Git-Tag: ldb-2.0.5~506 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90a82a41cfd6981397aa5c4e4b462bf14e57cd66;p=thirdparty%2Fsamba.git s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error Fix source4/torture/raw/open.c:1009: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck] source4/torture/raw/open.c:1048: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck] Signed-off-by: Noel Power Reviewed-by: Andreas Schneider --- diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index 5e8c81c9d07..220313ed83d 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -1006,7 +1006,8 @@ static bool test_nttrans_create(struct torture_context *tctx, struct smbcli_stat /* Check some create options (these all should be ignored) */ for (i=0; i < 32; i++) { - uint32_t create_option = (1 << i) & NTCREATEX_OPTIONS_MUST_IGNORE_MASK; + uint32_t create_option = + ((uint32_t)1 << i) & NTCREATEX_OPTIONS_MUST_IGNORE_MASK; if (create_option == 0) { continue; } @@ -1045,7 +1046,7 @@ static bool test_nttrans_create(struct torture_context *tctx, struct smbcli_stat not_a_directory_mask = 0; unexpected_mask = 0; for (i=0; i < 32; i++) { - uint32_t create_option = 1<