FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 08-08-2012, 09:06 PM
Mikulas Patocka
 
Default dm-verity: fix overflow checking

BTW. This patch improves dm-verity overflow checking.

Mikulas

---

dm-verity: fix overflow checking

Overflow checking in dm-verity was not sufficient.
It would check overflow if sector_t was smaller than long long but not
if sector_t and long long have the same size. This patch implements
proper overflow checking.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
drivers/md/dm-verity.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-3.5-fast/drivers/md/dm-verity.c
================================================== =================
--- linux-3.5-fast.orig/drivers/md/dm-verity.c 2012-08-08 21:24:00.000000000 +0200
+++ linux-3.5-fast/drivers/md/dm-verity.c 2012-08-08 21:28:06.000000000 +0200
@@ -718,8 +718,8 @@ static int verity_ctr(struct dm_target *
v->hash_dev_block_bits = ffs(num) - 1;

if (sscanf(argv[5], "%llu%c", &num_ll, &dummy) != 1 ||
- num_ll << (v->data_dev_block_bits - SECTOR_SHIFT) !=
- (sector_t)num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) {
+ (sector_t)(num_ll << (v->data_dev_block_bits - SECTOR_SHIFT))
+ >> (v->data_dev_block_bits - SECTOR_SHIFT) != nul_ll) {
ti->error = "Invalid data blocks";
r = -EINVAL;
goto bad;
@@ -733,8 +733,8 @@ static int verity_ctr(struct dm_target *
}

if (sscanf(argv[6], "%llu%c", &num_ll, &dummy) != 1 ||
- num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT) !=
- (sector_t)num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT)) {
+ (sector_t)(num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT))
+ >> (v->hash_dev_block_bits - SECTOR_SHIFT) != num_ll) {
ti->error = "Invalid hash start";
r = -EINVAL;
goto bad;

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 08:17 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org