nilfs_clean_parse_min_reclaimable() function changes value of
min_reclaimable_blocks_unit even if a given percentage value is
invalid.  Although it doesn't cause any actual problems since its only
caller, nilfs_clean_parse_options(), will immediately abort the
program when nilfs_clean_parse_min_reclaimable() returned an error
status code (-1), it is not sane for
nilfs_clean_parse_min_reclaimable() function itself.

Cc: Andreas Rohner <[email protected]>
Signed-off-by: Ryusuke Konishi <[email protected]>
---
 sbin/nilfs-clean/nilfs-clean.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/nilfs-clean/nilfs-clean.c b/sbin/nilfs-clean/nilfs-clean.c
index 62130c4..ab2180a 100644
--- a/sbin/nilfs-clean/nilfs-clean.c
+++ b/sbin/nilfs-clean/nilfs-clean.c
@@ -407,12 +407,12 @@ static int nilfs_clean_parse_min_reclaimable(const char 
*arg)
        }
 
        if (endptr[0] == '%') {
-               min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_PERCENT;
                if (blocks > 100) {
                        myprintf(_("Error: percent value can't be > 100: %s\n"),
                                        arg);
                        return -1;
                }
+               min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_PERCENT;
        } else {
                min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_NONE;
        }
-- 
1.7.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to