Message ID | 20240521074955.78675-2-pvorel@suse.cz |
---|---|
State | Accepted |
Headers | show |
Series | libswap: Fix SLE12-SP5 + cleanup | expand |
Hi Petr, For series: Reviewed-by: Li Wang <liwang@redhat.com> On Tue, May 21, 2024 at 3:50 PM Petr Vorel <pvorel@suse.cz> wrote: > Signed-off-by: Petr Vorel <pvorel@suse.cz> > --- > Changes v1->v2: > * Separated from the next commit > > libs/libltpswap/libswap.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c > index eb066df71..0066ca734 100644 > --- a/libs/libltpswap/libswap.c > +++ b/libs/libltpswap/libswap.c > @@ -93,7 +93,9 @@ static int file_is_contiguous(const char *filename) > > fd = SAFE_OPEN(filename, O_RDONLY); > > - fiemap = (struct fiemap *)SAFE_MALLOC(sizeof(struct fiemap) + > sizeof(struct fiemap_extent)); > + fiemap = (struct fiemap *)SAFE_MALLOC(sizeof(struct fiemap) > + + sizeof(struct > fiemap_extent)); > + > memset(fiemap, 0, sizeof(struct fiemap) + sizeof(struct > fiemap_extent)); > > fiemap->fm_start = 0; > @@ -243,7 +245,8 @@ bool is_swap_supported(const char *filename) > */ > int tst_max_swapfiles(void) > { > - unsigned int swp_migration_num = 0, swp_hwpoison_num = 0, > swp_device_num = 0, swp_pte_marker_num = 0; > + unsigned int swp_migration_num = 0, swp_hwpoison_num = 0, > + swp_device_num = 0, swp_pte_marker_num = 0; > struct tst_kconfig_var migration = > TST_KCONFIG_INIT("CONFIG_MIGRATION"); > struct tst_kconfig_var memory = > TST_KCONFIG_INIT("CONFIG_MEMORY_FAILURE"); > struct tst_kconfig_var device = > TST_KCONFIG_INIT("CONFIG_DEVICE_PRIVATE"); > @@ -281,7 +284,8 @@ int tst_max_swapfiles(void) > swp_pte_marker_num = 1; > } > > - return DEFAULT_MAX_SWAPFILE - swp_migration_num - swp_hwpoison_num > - swp_device_num - swp_pte_marker_num; > + return DEFAULT_MAX_SWAPFILE - swp_migration_num - swp_hwpoison_num > + - swp_device_num - swp_pte_marker_num; > } > > /* > -- > 2.43.0 > >
diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c index eb066df71..0066ca734 100644 --- a/libs/libltpswap/libswap.c +++ b/libs/libltpswap/libswap.c @@ -93,7 +93,9 @@ static int file_is_contiguous(const char *filename) fd = SAFE_OPEN(filename, O_RDONLY); - fiemap = (struct fiemap *)SAFE_MALLOC(sizeof(struct fiemap) + sizeof(struct fiemap_extent)); + fiemap = (struct fiemap *)SAFE_MALLOC(sizeof(struct fiemap) + + sizeof(struct fiemap_extent)); + memset(fiemap, 0, sizeof(struct fiemap) + sizeof(struct fiemap_extent)); fiemap->fm_start = 0; @@ -243,7 +245,8 @@ bool is_swap_supported(const char *filename) */ int tst_max_swapfiles(void) { - unsigned int swp_migration_num = 0, swp_hwpoison_num = 0, swp_device_num = 0, swp_pte_marker_num = 0; + unsigned int swp_migration_num = 0, swp_hwpoison_num = 0, + swp_device_num = 0, swp_pte_marker_num = 0; struct tst_kconfig_var migration = TST_KCONFIG_INIT("CONFIG_MIGRATION"); struct tst_kconfig_var memory = TST_KCONFIG_INIT("CONFIG_MEMORY_FAILURE"); struct tst_kconfig_var device = TST_KCONFIG_INIT("CONFIG_DEVICE_PRIVATE"); @@ -281,7 +284,8 @@ int tst_max_swapfiles(void) swp_pte_marker_num = 1; } - return DEFAULT_MAX_SWAPFILE - swp_migration_num - swp_hwpoison_num - swp_device_num - swp_pte_marker_num; + return DEFAULT_MAX_SWAPFILE - swp_migration_num - swp_hwpoison_num + - swp_device_num - swp_pte_marker_num; } /*
Signed-off-by: Petr Vorel <pvorel@suse.cz> --- Changes v1->v2: * Separated from the next commit libs/libltpswap/libswap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)