aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/vnic_vic.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/net/enic/vnic_vic.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/net/enic/vnic_vic.c')
-rw-r--r--drivers/net/enic/vnic_vic.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c
index 197c9d24af82..24ef8cd40545 100644
--- a/drivers/net/enic/vnic_vic.c
+++ b/drivers/net/enic/vnic_vic.c
@@ -23,7 +23,8 @@
23 23
24#include "vnic_vic.h" 24#include "vnic_vic.h"
25 25
26struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type) 26struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
27 const u8 type)
27{ 28{
28 struct vic_provinfo *vp; 29 struct vic_provinfo *vp;
29 30
@@ -47,15 +48,15 @@ void vic_provinfo_free(struct vic_provinfo *vp)
47} 48}
48 49
49int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length, 50int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
50 void *value) 51 const void *value)
51{ 52{
52 struct vic_provinfo_tlv *tlv; 53 struct vic_provinfo_tlv *tlv;
53 54
54 if (!vp || !value) 55 if (!vp || !value)
55 return -EINVAL; 56 return -EINVAL;
56 57
57 if (ntohl(vp->length) + sizeof(*tlv) + length > 58 if (ntohl(vp->length) + offsetof(struct vic_provinfo_tlv, value) +
58 VIC_PROVINFO_MAX_TLV_DATA) 59 length > VIC_PROVINFO_MAX_TLV_DATA)
59 return -ENOMEM; 60 return -ENOMEM;
60 61
61 tlv = (struct vic_provinfo_tlv *)((u8 *)vp->tlv + 62 tlv = (struct vic_provinfo_tlv *)((u8 *)vp->tlv +
@@ -66,7 +67,8 @@ int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
66 memcpy(tlv->value, value, length); 67 memcpy(tlv->value, value, length);
67 68
68 vp->num_tlvs = htonl(ntohl(vp->num_tlvs) + 1); 69 vp->num_tlvs = htonl(ntohl(vp->num_tlvs) + 1);
69 vp->length = htonl(ntohl(vp->length) + sizeof(*tlv) + length); 70 vp->length = htonl(ntohl(vp->length) +
71 offsetof(struct vic_provinfo_tlv, value) + length);
70 72
71 return 0; 73 return 0;
72} 74}