s4/torture/unix: cppcheck: Fix shiftTooManyBitsSigned error
authorNoel Power <noel.power@suse.com>
Wed, 22 May 2019 13:10:47 +0000 (13:10 +0000)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 4 Jun 2019 22:13:07 +0000 (22:13 +0000)
Fixes

source4/torture/unix/unix_info2.c:300: 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/unix/unix_info2.c

index 14f6d776081e1018561a9a7a559a474790c05900..069a5818e13f93390ade059205de0e63fa9fb6f0 100644 (file)
@@ -297,7 +297,7 @@ static bool verify_setinfo_flags(void *mem_ctx,
         * that flag is in our requested mask.
         */
        for (i = 0; i < 32; ++i) {
-               info2.file_flags = (1 << i);
+               info2.file_flags = ((uint32_t)1 << i);
                info2.flags_mask = smb_fmask | info2.file_flags;
 
                set_no_metadata_change(&info2);