lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8c56e9f5-9e82-4a79-aa82-49099c1dda71@suse.de>
Date: Tue, 5 Aug 2025 08:57:07 +0200
From: Hannes Reinecke <hare@...e.de>
To: Keith Busch <kbusch@...nel.org>
Cc: Keith Busch <kbusch@...a.com>, linux-block@...r.kernel.org,
 linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
 snitzer@...nel.org, axboe@...nel.dk, dw@...idwei.uk, brauner@...nel.org
Subject: Re: [PATCH 3/7] block: simplify direct io validity check

On 8/4/25 19:11, Keith Busch wrote:
> On Mon, Aug 04, 2025 at 08:55:36AM +0200, Hannes Reinecke wrote:
>> On 8/2/25 01:47, Keith Busch wrote:
>>>    static bool blkdev_dio_invalid(struct block_device *bdev, struct kiocb *iocb,
>>>    				struct iov_iter *iter)
>>>    {
>>> -	return iocb->ki_pos & (bdev_logical_block_size(bdev) - 1) ||
>>> -		!bdev_iter_is_aligned(bdev, iter);
>>> +	return (iocb->ki_pos | iov_iter_count(iter)) &
>>> +			(bdev_logical_block_size(bdev) - 1);
>>
>> Bitwise or? Sure?
> 
> Yep, this is correct. We need to return an error if either the size or
> offset are not aligned to the block size. "Or"ing the two together gets
> us a single check against the logical block size mask instead of doing
> each individually.

Oh, my. Wasn't aware that we're running an obfuscated C-contest ...

Anyway.

Reviewed-by: Hannes Reinecke <hare@...e.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@...e.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ