aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c
index a9619d880354..da3a99e85b1e 100644
--- a/drivers/md/bcache/util.c
+++ b/drivers/md/bcache/util.c
@@ -76,7 +76,7 @@ STRTO_H(strtoull, unsigned long long)
76ssize_t bch_hprint(char *buf, int64_t v) 76ssize_t bch_hprint(char *buf, int64_t v)
77{ 77{
78 static const char units[] = "?kMGTPEZY"; 78 static const char units[] = "?kMGTPEZY";
79 char dec[3] = ""; 79 char dec[4] = "";
80 int u, t = 0; 80 int u, t = 0;
81 81
82 for (u = 0; v >= 1024 || v <= -1024; u++) { 82 for (u = 0; v >= 1024 || v <= -1024; u++) {
@@ -88,7 +88,7 @@ ssize_t bch_hprint(char *buf, int64_t v)
88 return sprintf(buf, "%llu", v); 88 return sprintf(buf, "%llu", v);
89 89
90 if (v < 100 && v > -100) 90 if (v < 100 && v > -100)
91 sprintf(dec, ".%i", t / 100); 91 snprintf(dec, sizeof(dec), ".%i", t / 100);
92 92
93 return sprintf(buf, "%lli%s%c", v, dec, units[u]); 93 return sprintf(buf, "%lli%s%c", v, dec, units[u]);
94} 94}