OSDN Git Service

diskconfig: Fix disk_layout.conf size parsing
authorAndrew Boie <andrew.p.boie@intel.com>
Fri, 11 Nov 2011 01:58:05 +0000 (17:58 -0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sat, 6 May 2017 14:51:40 +0000 (22:51 +0800)
If the user was appending 'K' to their lengths (which is valid
but redundant) it was being treated as megabytes instead of
kilobytes.

Change-Id: I979ec4d01f1342de1f3209b946201ca87bad32a7

libdiskconfig/diskconfig.c

index 1167d4b..8f337cf 100644 (file)
@@ -76,7 +76,7 @@ parse_len(const char *str, uint64_t *plen)
         }
     } else {
         /* convert len to kilobytes */
-        if (multiple > 1024)
+        if (multiple >= 1024)
             multiple >>= 10;
         *plen *= multiple;