LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] ocfs2: eliminate a misreported warning
@ 2018-04-25 11:29 Zhen Lei
  0 siblings, 0 replies; only message in thread
From: Zhen Lei @ 2018-04-25 11:29 UTC (permalink / raw)
  To: Mark Fasheh, Joel Becker, ocfs2-devel, linux-kernel
  Cc: Hanjun Guo, Libin, Kefeng Wang, Zhen Lei

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(-)

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)
--
1.8.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-25 11:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 11:29 [PATCH 1/1] ocfs2: eliminate a misreported warning Zhen Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).