Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 5e20797

Browse files
aalexandrovichgregkh
authored andcommitted
fs/ntfs3: Refactor enum_rstbl to suppress static checker
[ Upstream commit 56c16d5 ] Comments and brief description of function enum_rstbl added. Fixes: b46acd6 ("fs/ntfs3: Add NTFS journal") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent cdb1efe commit 5e20797

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

fs/ntfs3/fslog.c

+17-2
Original file line numberDiff line numberDiff line change
@@ -609,14 +609,29 @@ static inline void add_client(struct CLIENT_REC *ca, u16 index, __le16 *head)
609609
*head = cpu_to_le16(index);
610610
}
611611

612+
/*
613+
* Enumerate restart table.
614+
*
615+
* @t - table to enumerate.
616+
* @c - current enumerated element.
617+
*
618+
* enumeration starts with @c == NULL
619+
* returns next element or NULL
620+
*/
612621
static inline void *enum_rstbl(struct RESTART_TABLE *t, void *c)
613622
{
614623
__le32 *e;
615624
u32 bprt;
616-
u16 rsize = t ? le16_to_cpu(t->size) : 0;
625+
u16 rsize;
626+
627+
if (!t)
628+
return NULL;
629+
630+
rsize = le16_to_cpu(t->size);
617631

618632
if (!c) {
619-
if (!t || !t->total)
633+
/* start enumeration. */
634+
if (!t->total)
620635
return NULL;
621636
e = Add2Ptr(t, sizeof(struct RESTART_TABLE));
622637
} else {

0 commit comments

Comments
 (0)