From 1ed1220fc817b109368d1f587c75faa1d3057b46 Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Thu, 21 May 2015 17:03:05 +0900 Subject: [PATCH] libstorage: Add memory size check routine If a memory size is zero, it does not try to divide by zero. Change-Id: Ieeff37b0d527f0edba7d06f54f4f31081632f9b9 Signed-off-by: Jiyoung Yun --- src/statvfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/statvfs.c b/src/statvfs.c index ca2c62b..81d323f 100644 --- a/src/statvfs.c +++ b/src/statvfs.c @@ -250,7 +250,7 @@ API int storage_get_internal_memory_size(struct statvfs *buf) } ret = get_memory_size(MEMORY_STATUS_USR_PATH, &temp); - if (ret) { + if (ret || temp.f_bsize == 0) { _E("fail to get memory size"); return -errno; } -- 2.7.4