Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 376926
b: refs/heads/master
c: 5460fc0
h: refs/heads/master
v: v3
  • Loading branch information
Dan Carpenter authored and Matthew Wilcox committed May 17, 2013
1 parent 81df7fd commit 37ba98c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5be37bf9c17ffad0590a4044dbb110fe08066923
refs/heads/master: 5460fc03105fbed01fe27aa572d9f65bb410a61d
5 changes: 3 additions & 2 deletions trunk/drivers/block/nvme-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,

if (addr & 3)
return ERR_PTR(-EINVAL);
if (!length)
if (!length || length > INT_MAX - PAGE_SIZE)
return ERR_PTR(-EINVAL);

offset = offset_in_page(addr);
Expand All @@ -1227,7 +1227,8 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
sg_init_table(sg, count);
for (i = 0; i < count; i++) {
sg_set_page(&sg[i], pages[i],
min_t(int, length, PAGE_SIZE - offset), offset);
min_t(unsigned, length, PAGE_SIZE - offset),
offset);
length -= (PAGE_SIZE - offset);
offset = 0;
}
Expand Down

0 comments on commit 37ba98c

Please sign in to comment.