Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360780
b: refs/heads/master
c: 70fc69b
h: refs/heads/master
v: v3
  • Loading branch information
Lee A. Roberts authored and David S. Miller committed Feb 28, 2013
1 parent c8fc876 commit 6f8efe8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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: 726bc6b092da4c093eb74d13c07184b18c1af0f1
refs/heads/master: 70fc69bc5a54d9776ace7c99d46eb533f8fb6e89
13 changes: 7 additions & 6 deletions trunk/net/sctp/tsnmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
static void sctp_tsnmap_update(struct sctp_tsnmap *map);
static void sctp_tsnmap_find_gap_ack(unsigned long *map, __u16 off,
__u16 len, __u16 *start, __u16 *end);
static int sctp_tsnmap_grow(struct sctp_tsnmap *map, u16 gap);
static int sctp_tsnmap_grow(struct sctp_tsnmap *map, u16 size);

/* Initialize a block of memory as a tsnmap. */
struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *map, __u16 len,
Expand Down Expand Up @@ -124,7 +124,7 @@ int sctp_tsnmap_mark(struct sctp_tsnmap *map, __u32 tsn,

gap = tsn - map->base_tsn;

if (gap >= map->len && !sctp_tsnmap_grow(map, gap))
if (gap >= map->len && !sctp_tsnmap_grow(map, gap + 1))
return -ENOMEM;

if (!sctp_tsnmap_has_gap(map) && gap == 0) {
Expand Down Expand Up @@ -360,23 +360,24 @@ __u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map,
return ngaps;
}

static int sctp_tsnmap_grow(struct sctp_tsnmap *map, u16 gap)
static int sctp_tsnmap_grow(struct sctp_tsnmap *map, u16 size)
{
unsigned long *new;
unsigned long inc;
u16 len;

if (gap >= SCTP_TSN_MAP_SIZE)
if (size > SCTP_TSN_MAP_SIZE)
return 0;

inc = ALIGN((gap - map->len),BITS_PER_LONG) + SCTP_TSN_MAP_INCREMENT;
inc = ALIGN((size - map->len), BITS_PER_LONG) + SCTP_TSN_MAP_INCREMENT;
len = min_t(u16, map->len + inc, SCTP_TSN_MAP_SIZE);

new = kzalloc(len>>3, GFP_ATOMIC);
if (!new)
return 0;

bitmap_copy(new, map->tsn_map, map->max_tsn_seen - map->base_tsn);
bitmap_copy(new, map->tsn_map,
map->max_tsn_seen - map->cumulative_tsn_ack_point);
kfree(map->tsn_map);
map->tsn_map = new;
map->len = len;
Expand Down

0 comments on commit 6f8efe8

Please sign in to comment.