From: Henrique Carvalho <henrique.carvalho@suse.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-cifs@vger.kernel.org
Subject: Re: [bug report] smb: client: batch SRV_COPYCHUNK entries to cut roundtrips
Date: Thu, 18 Sep 2025 17:19:14 -0300 [thread overview]
Message-ID: <d06bcf7d-81bb-495c-92e4-582c44df9de8@suse.com> (raw)
In-Reply-To: <aMvUdFU-ciu7Rgc6@stanley.mountain>
Hi Dan,
Thanks for the report.
On 9/18/25 6:44 AM, Dan Carpenter wrote:
> Hello Henrique Carvalho,
>
> Commit 4e3acdf94c89 ("smb: client: batch SRV_COPYCHUNK entries to cut
> roundtrips") from Sep 16, 2025 (linux-next), leads to the following
> Smatch static checker warning:
>
> fs/smb/client/smb2ops.c:1937 smb2_copychunk_range()
> error: uninitialized symbol 'ret_data_len'.
>
> --> 1937 if (ret_data_len != sizeof(struct copychunk_ioctl_rsp)) {
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Using unintialized variables doesn't work because runtime checkers like
> UBSan will complain as well as static checkers.
I will update the patch to initialize ret_data_len.
> But the other issue is that this code treats -EINVAL as having a special
> meaning. -EINVAL is the most common error code. All the places which
> treat -EINVAL as having a special meaning end up buggy in the end. Mostly
> they start out buggy, but even the ones which aren't buggy from the start
> end up buggy over time.
-EINVAL is mapped from the SMB2 server returned error
STATUS_INVALID_PARAMETER, so I don't know if there is anything that can
be done here.
After your email, I considered returning -EOPNOTSUPP instead to trigger
kernel-side copy fallback, but returning -EINVAL also seems to have the
practical advantage of having a successful copy, but with fewer network
roundtrips (apparently due to userspace fallback, but I haven't digged
too much into it).
If there's consensus that changing this error mapping would improve the
overall robustness of the code path, I'm open to that approach.
--
Henrique
SUSE Labs
next prev parent reply other threads:[~2025-09-18 20:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 9:44 [bug report] smb: client: batch SRV_COPYCHUNK entries to cut roundtrips Dan Carpenter
2025-09-18 20:19 ` Henrique Carvalho [this message]
2025-09-18 20:59 ` Henrique Carvalho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d06bcf7d-81bb-495c-92e4-582c44df9de8@suse.com \
--to=henrique.carvalho@suse.com \
--cc=dan.carpenter@linaro.org \
--cc=linux-cifs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.