public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Uday Shankar <ushankar@purestorage.com>,
	Caleb Sander Mateos <csander@purestorage.com>
Subject: Re: [PATCH] selftests: ublk: fix user_data truncation for tgt_data >= 256
Date: Thu, 23 Oct 2025 22:15:36 +0800	[thread overview]
Message-ID: <aPo4iHZt8sO9wJvT@fedora> (raw)
In-Reply-To: <20251023105141.2515921-1-ming.lei@redhat.com>

On Thu, Oct 23, 2025 at 06:51:41PM +0800, Ming Lei wrote:
> The build_user_data() function packs multiple fields into a __u64
> value using bit shifts. Without explicit __u64 casts before shifting,
> the shift operations are performed on 32-bit unsigned integers before
> being promoted to 64-bit, causing data loss.
> 
> Specifically, when tgt_data >= 256, the expression (tgt_data << 24)
> shifts on a 32-bit value, truncating the upper 8 bits before promotion
> to __u64. Since tgt_data can be up to 16 bits (assertion allows up to
> 65535), values >= 256 would have their high byte lost.
> 
> Add explicit __u64 casts to both op and tgt_data before shifting to
> ensure the shift operations happen in 64-bit space, preserving all
> bits of the input values.
> 
> Fixes: 6aecda00b7d1 ("selftests: ublk: add kernel selftests for ublk")
> Signed-off-by: Ming Lei <ming.lei@redhat.com>

Hi Jens,

Looks this patch can't be applied cleanly, please ignore it, and sorry for
the noise.

Thanks,
Ming


      reply	other threads:[~2025-10-23 14:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 10:51 [PATCH] selftests: ublk: fix user_data truncation for tgt_data >= 256 Ming Lei
2025-10-23 14:15 ` Ming Lei [this message]

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=aPo4iHZt8sO9wJvT@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ushankar@purestorage.com \
    /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