diff --git a/port/cpl_vsil_s3.cpp b/port/cpl_vsil_s3.cpp index efe3c5b1a44a..21874af71f61 100644 --- a/port/cpl_vsil_s3.cpp +++ b/port/cpl_vsil_s3.cpp @@ -807,7 +807,8 @@ size_t IVSIS3LikeFSHandler::GetUploadChunkSizeInBytes( nChunkSize = static_cast(GetDefaultPartSizeInMiB()) * MIB_CONSTANT; } - else if (nChunkSizeInt / MIB_CONSTANT >= GetMaximumPartSizeInMiB()) + else if (nChunkSizeInt > + static_cast(GetMaximumPartSizeInMiB()) * MIB_CONSTANT) { CPLError(CE_Warning, CPLE_AppDefined, "Specified chunk size too large. Clamping to %d MiB",