Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117013
b: refs/heads/master
c: d63a5ce
h: refs/heads/master
i:
  117011: 0475213
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Oct 21, 2008
1 parent de8cb6d commit 1ce1ef6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 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: 7acedc5b98a2fcff64f00c21110aae7d3ac2f7df
refs/heads/master: d63a5ce3c0d25c96bdadc78792e5b48b846e899d
3 changes: 0 additions & 3 deletions trunk/drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,6 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors,
size_t len;
struct mirror_set *ms = NULL;

if (array_too_big(sizeof(*ms), sizeof(ms->mirror[0]), nr_mirrors))
return NULL;

len = sizeof(*ms) + (sizeof(ms->mirror[0]) * nr_mirrors);

ms = kzalloc(len, GFP_KERNEL);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/md/dm-stripe.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ static inline struct stripe_c *alloc_context(unsigned int stripes)
{
size_t len;

if (array_too_big(sizeof(struct stripe_c), sizeof(struct stripe),
stripes))
if (dm_array_too_big(sizeof(struct stripe_c), sizeof(struct stripe),
stripes))
return NULL;

len = sizeof(struct stripe_c) + (sizeof(struct stripe) * stripes);
Expand Down
9 changes: 0 additions & 9 deletions trunk/drivers/md/dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ void dm_put_target_type(struct target_type *t);
int dm_target_iterate(void (*iter_func)(struct target_type *tt,
void *param), void *param);

/*-----------------------------------------------------------------
* Useful inlines.
*---------------------------------------------------------------*/
static inline int array_too_big(unsigned long fixed, unsigned long obj,
unsigned long num)
{
return (num > (ULONG_MAX - fixed) / obj);
}

int dm_split_args(int *argc, char ***argvp, char *input);

/*
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/device-mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
*/
#define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz))

#define dm_array_too_big(fixed, obj, num) \
((num) > (UINT_MAX - (fixed)) / (obj))

static inline sector_t to_sector(unsigned long n)
{
return (n >> SECTOR_SHIFT);
Expand Down

0 comments on commit 1ce1ef6

Please sign in to comment.