diff options
| author | 2011-03-01 15:04:39 -0500 | |
|---|---|---|
| committer | 2011-03-01 15:04:39 -0500 | |
| commit | 6fae9c25134baffbeeb20031479e7ff6f6d8eec0 (patch) | |
| tree | c9ab89992ce5293a43cd455a81dc8a5926a28a5e /net/core/scm.c | |
| parent | block: share request flush fields with elevator_private (diff) | |
| parent | Linux 2.6.38-rc6 (diff) | |
| download | wireguard-linux-6fae9c25134baffbeeb20031479e7ff6f6d8eec0.tar.xz wireguard-linux-6fae9c25134baffbeeb20031479e7ff6f6d8eec0.zip | |
Merge commit 'v2.6.38-rc6' into for-2.6.39/core
Conflicts:
block/cfq-iosched.c
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'net/core/scm.c')
| -rw-r--r-- | net/core/scm.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/core/scm.c b/net/core/scm.c index 413cab89017d..bbe454450801 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -79,10 +79,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) return -ENOMEM; *fplp = fpl; fpl->count = 0; + fpl->max = SCM_MAX_FD; } fpp = &fpl->fp[fpl->count]; - if (fpl->count + num > SCM_MAX_FD) + if (fpl->count + num > fpl->max) return -EINVAL; /* @@ -331,11 +332,12 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) if (!fpl) return NULL; - new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); + new_fpl = kmemdup(fpl, offsetof(struct scm_fp_list, fp[fpl->count]), + GFP_KERNEL); if (new_fpl) { - for (i=fpl->count-1; i>=0; i--) + for (i = 0; i < fpl->count; i++) get_file(fpl->fp[i]); - memcpy(new_fpl, fpl, sizeof(*fpl)); + new_fpl->max = new_fpl->count; } return new_fpl; } |
