643999 fix a calculation error in get_system_size

Authored and Committed by Coiby Xu 2 years ago
1 file changed. 4 lines added. 9 lines removed.
    fix a calculation error in get_system_size
    
    Resolves: bz2074473
    Upstream: Fedora
    Conflict: None
    
    commit 5c23b6ebb79c5e06ff713d437cb54fb2843aa12d
    Author: Coiby Xu <coxu@redhat.com>
    Date:   Sat May 7 16:30:39 2022 +0800
    
        fix a calculation error in get_system_size
    
        Recently, it's found 'kdumpctl estimate' returns 512M while the system
        reserves 1024M kdump memory in a case. This happens because the ranges
        in /proc/iomem are inclusively. For example, "0-1: System RAM" means 2
        bytes of system memory other than 1 byte. Fix this error by adding one
        more byte.
    
        Note
        1. the function has been simplified as well.
        2. define PROC_IOMEM as /proc/iomem for the sake of unit tests
    
        Reported-by: Ruowen Qin <ruqin@redhat.com>
        Fixes: 1813189 ("kdump-lib.sh: introduce functions to return recommened mem size")
        Suggested-by: Philipp Rudo <prudo@redhat.com>
        Signed-off-by: Coiby Xu <coxu@redhat.com>
        Reviewed-by: Philipp Rudo <prudo@redhat.com>
    
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    
        
file modified
+4 -9