diff mbox series

[1/1] ocfs2: eliminate a misreported warning

Message ID 1524655799-12112-1-git-send-email-thunder.leizhen@huawei.com
State New
Headers show
Series [1/1] ocfs2: eliminate a misreported warning | expand

Commit Message

Zhen Lei April 25, 2018, 11:29 a.m. UTC
Below warning can not be happened, because the parameter chunksize passed
from ocfs2_info_freefrag_scan_chain-->ocfs2_info_update_ffg is guaranteed
to be positive. So __ilog2_u32 is impossible return -1.

fs/ocfs2/ioctl.c: In function 'ocfs2_info_update_ffg':
fs/ocfs2/ioctl.c:411:17: warning: array subscript is below array bounds [-Warray-bounds]
  hist->fc_chunks[index]++;
                 ^
fs/ocfs2/ioctl.c:411:17: warning: array subscript is below array bounds [-Warray-bounds]

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

---
 fs/ocfs2/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.8.3
diff mbox series

Patch

diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index ab30c005..994726a 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -402,7 +402,7 @@  static int ocfs2_info_handle_freeinode(struct inode *inode,
 static void o2ffg_update_histogram(struct ocfs2_info_free_chunk_list *hist,
 				   unsigned int chunksize)
 {
-	int index;
+	u32 index;

 	index = __ilog2_u32(chunksize);
 	if (index >= OCFS2_INFO_MAX_HIST)