Re: [PATCH] ksmbd: remove unreachable input length check in FSCTL_SET_SPARSE

From: Namjae Jeon

Date: Mon Nov 16 2026 - 06:50:53 EST


On Mon, Nov 16, 2026 at 12:23 PM Yiqing Wu
<wuyiqing@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> The FSCTL_SET_SPARSE handler checks whether a nonzero input buffer is
> smaller than sizeof(struct file_sparse) before parsing it. That
> structure holds a single __packed byte, so a nonzero in_buf_len is
> always at least sizeof(struct file_sparse) and the condition can never
> be true. GCC flags the dead test when building with W=2:
>
> fs/smb/server/smb2pdu.c:12035:32: warning: logical and of mutually exclusive tests is always false [-Wlogical-op]
>
> Remove the unreachable branch. A zero-length input is still handled
> by the call site, which passes the local SetSparse default instead of
> the request buffer.
>
> Signed-off-by: Yiqing Wu <wuyiqing@xxxxxxxxxxxxxxxxxxxx>
Applied it to #ksmbd-for-next.
Thanks!