public inbox for linux-cifs@vger.kernel.org
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong.chenxiaosong@linux.dev>
To: Henrique Carvalho <henrique.carvalho@suse.com>
Cc: Steve French <smfrench@gmail.com>,
	Youling Tang <tangyouling@kylinos.cn>,
	Namjae Jeon <linkinjeon@kernel.org>,
	David Howells <dhowells@redhat.com>,
	CIFS <linux-cifs@vger.kernel.org>,
	Meetakshi Setiya <meetakshisetiyaoss@gmail.com>,
	gustavoars@kernel.org
Subject: Re: generic/013 failure to Samba
Date: Sat, 27 Dec 2025 00:01:18 +0800	[thread overview]
Message-ID: <b75f093a-6546-4b90-b4d0-879aa81cd327@linux.dev> (raw)
In-Reply-To: <xrumab2vstnivbhiafrjhzflztii6bxfwrlfs3lfjc7lwsbty7@3jozs5y6lxg7>

Yes, you are correct. I didn't consider `cpu_to_le32()`.

How about changing it to the following?
```
smb2_copychunk_range()
{
	...
	chunks = 0;
	while (copy_bytes_left > 0 && chunks < chunk_count) {
		cc_req->ChunkCount = cpu_to_le32(++chunks);
		chunk = &cc_req->Chunks[chunks - 1];
		...
	}
	...
}
```

I also agree with your point about the Fixes tag.

Thanks,
ChenXiaoSong.

On 12/26/25 11:45 PM, Henrique Carvalho wrote:
> I don't agree with the proposed changes for a couple of reasons:
> 
> 1. ChunkCount is an on-wire __le32. Using it as the loop counter mixes
> endianness-annotated storage with CPU-endian arithmetic and would either
> require constant cpu_to_le32()/le32_to_cpu() conversions or be
> type/endianness misuse. The current CPU-endian u32 chunks counter is
> intentional.
> 
> 2. Re: "Fixes:" tags: the UBSAN report exists because Chunks[] is now
> __counted_by_le(ChunkCount). We currently index Chunks[] while
> ChunkCount is still zero, so the __counted_by contract is violated. That
> points to the commit that introduced the annotation as the Fixes target.
> I don't think the batching commit should be tagged unless it introduced
> a functional issue independent of the annotation.


  reply	other threads:[~2025-12-26 16:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23  0:19 generic/013 failure to Samba Steve French
2025-12-24 15:02 ` Henrique Carvalho
2025-12-26  4:36   ` ChenXiaoSong
2025-12-26  6:44     ` ChenXiaoSong
2025-12-26  7:49       ` ChenXiaoSong
2025-12-26 15:45       ` Henrique Carvalho
2025-12-26 16:01         ` ChenXiaoSong [this message]
2025-12-26 18:05           ` Henrique Carvalho
2025-12-26 22:48             ` ChenXiaoSong
     [not found]               ` <CAH2r5mtaGgiWLnMebWeGNoyVKY81xj6DkZY5iTmWkJZ_gvyeLw@mail.gmail.com>
     [not found]                 ` <7919537a-d3b5-45cd-9032-0a5312b28dfb@linux.dev>
2025-12-26 23:46                   ` ChenXiaoSong
2025-12-26 15:33   ` 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=b75f093a-6546-4b90-b4d0-879aa81cd327@linux.dev \
    --to=chenxiaosong.chenxiaosong@linux.dev \
    --cc=dhowells@redhat.com \
    --cc=gustavoars@kernel.org \
    --cc=henrique.carvalho@suse.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=meetakshisetiyaoss@gmail.com \
    --cc=smfrench@gmail.com \
    --cc=tangyouling@kylinos.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox