STRING_UNITS_2,         /* use binary powers of 2^10 */
 };
 
-void string_get_size(u64 size, u64 blk_size, enum string_size_units units,
-                    char *buf, int len);
+int string_get_size(u64 size, u64 blk_size, enum string_size_units units,
+                   char *buf, int len);
 
 int parse_int_array_user(const char __user *from, size_t count, int **array);
 
 
  * giving the size in the required units.  @buf should have room for
  * at least 9 bytes and will always be zero terminated.
  *
+ * Return value: number of characters of output that would have been written
+ * (which may be greater than len, if output was truncated).
  */
-void string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
-                    char *buf, int len)
+int string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
+                   char *buf, int len)
 {
        static const char *const units_10[] = {
                "B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"
        else
                unit = units_str[units][i];
 
-       snprintf(buf, len, "%u%s %s", (u32)size,
-                tmp, unit);
+       return snprintf(buf, len, "%u%s %s", (u32)size,
+                       tmp, unit);
 }
 EXPORT_SYMBOL(string_get_size);