Projects
Eulaceura:Mainline:GA
thin-provisioning-tools
_service:obs_scm:0011-thin_show_duplicates-Fix-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0011-thin_show_duplicates-Fix-potential-errors.patch of Package thin-provisioning-tools
From 759407445f4e1c31cc0d7bff2881ebd981e2d8fe Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai <mtsai@redhat.com> Date: Wed, 2 Jun 2021 01:23:13 +0800 Subject: [PATCH] [thin_show_duplicates] Fix potential errors - Fix error if no --block-sector provided - Fix errors on pools without mappings, or zero-length file --- thin-provisioning/thin_show_duplicates.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/thin_show_duplicates.cc b/thin-provisioning/thin_show_duplicates.cc index b1eebb74..f7354eb4 100644 --- a/thin-provisioning/thin_show_duplicates.cc +++ b/thin-provisioning/thin_show_duplicates.cc @@ -56,7 +56,7 @@ using namespace thin_provisioning; namespace { bool factor_of(block_address f, block_address n) { - return (n % f) == 0; + return f && (n % f) == 0; } uint64_t parse_int(string const &str, string const &desc) { @@ -132,11 +132,15 @@ namespace { class duplicate_detector { public: void scan_with_variable_sized_chunks(chunk_stream &stream) { + if (!stream.size()) + return; variable_chunk_stream vstream(stream, 4096); scan(vstream); } void scan_with_fixed_sized_chunks(chunk_stream &stream, block_address chunk_size) { + if (!stream.size()) + return; fixed_chunk_stream fstream(stream, chunk_size); scan(fstream); } @@ -222,7 +226,7 @@ namespace { if (fs.content_based_chunks) detector.scan_with_variable_sized_chunks(pstream); else { - if (*fs.block_size) { + if (!!fs.block_size) { if (factor_of(*fs.block_size, block_size)) block_size = *fs.block_size; else
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2