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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 30 Jul 2014 19:12:44 +0300
From:	Boaz Harrosh <>
To:	Matthew Wilcox <>,,,
Subject: Re: [PATCH v8 04/22] Change direct_access calling convention

On 07/30/2014 07:03 PM, Boaz Harrosh wrote:
>> +long bdev_direct_access(struct block_device *bdev, sector_t sector,
>> +			void **addr, unsigned long *pfn, long size)
>> +{
>> +	const struct block_device_operations *ops = bdev->bd_disk->fops;
>> +	if (!ops->direct_access)
>> +		return -EOPNOTSUPP;
> You need to check alignment on PAGE_SIZE since this API requires it, do
> to pfn defined to a page_number.
> (Unless you want to define another output-param like page_offset.
>  but this exercise can be left to the caller)
> You also need to check against the partition boundary. so something like:
> + 	if (sector & (PAGE_SECTORS-1))
> + 		return -EINVAL;
> +	if (unlikely(sector + size > part_nr_sects_read(bdev->bd_part)))

Off course I was wrong here size is in bytes not in sectors. Which points
out that maybe this API needs to be in sectors.

[Actually it needs to be in pages both size and offset, because of return of
pfn, but its your call.]

Anyway my code above needs to be fixed with
	(size + 512 -1) / 512


> + 		return -ERANGE;
> Then perhaps you can remove that check from drivers
>> +	return ops->direct_access(bdev, sector + get_start_sect(bdev), addr,
>> +					pfn, size);
>> +}
>> +EXPORT_SYMBOL_GPL(bdev_direct_access);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists