fs: erofs: Do NULL check before dereferencing pointer
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Fri, 4 Jul 2025 10:53:18 +0000 (11:53 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 11 Jul 2025 17:33:25 +0000 (11:33 -0600)
commitff8a41ce4947c6d7f1826990d5d7b96d30928e3f
tree5d232785f9e9c91752a45d94bfddf94e4a00ae0b
parenta21ec39944f93fb5bd3dd5de525e78cac988fdb6
fs: erofs: Do NULL check before dereferencing pointer

The assignments to sect and off use the pointer from ctxt.cur_dev but
that has not been NULL checked before this is done. So instead move the
assignments after the NULL check.

This issue found by Smatch

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Gao Xiang <xiang@kernel.org>
fs/erofs/fs.c