]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4/torture/smb2: cppcheck: Fix shiftTooManyBitsSigned error
authorNoel Power <noel.power@suse.com>
Wed, 22 May 2019 12:03:36 +0000 (12:03 +0000)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 4 Jun 2019 22:13:07 +0000 (22:13 +0000)
Fixes

source4/torture/smb2/create.c:197: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/create.c:234: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/smb2/create.c:265: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/smb2/create.c

index 0ede6add54abc25ff32034190294a69c4e90e15e..9b32062ab07f43089491fda7128be90ee98e8058 100644 (file)
@@ -194,7 +194,7 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
        {
                int i;
                for (i=0;i<32;i++) {
-                       io.in.create_options = 1<<i;
+                       io.in.create_options = (uint32_t)1<<i;
                        if (io.in.create_options & NTCREATEX_OPTIONS_DELETE_ON_CLOSE) {
                                continue;
                        }
@@ -231,7 +231,7 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
        {
                int i;
                for (i=0;i<32;i++) {
-                       io.in.desired_access = 1<<i;
+                       io.in.desired_access = (uint32_t)1<<i;
                        status = smb2_create(tree, tctx, &io);
                        if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) ||
                            NT_STATUS_EQUAL(status, NT_STATUS_PRIVILEGE_NOT_HELD)) {
@@ -262,7 +262,7 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
        {
                int i;
                for (i=0;i<32;i++) {
-                       io.in.file_attributes = 1<<i;
+                       io.in.file_attributes = (uint32_t)1<<i;
                        if (io.in.file_attributes & FILE_ATTRIBUTE_ENCRYPTED) {
                                continue;
                        }