diff options
author | Nicholas Mc Guire <hofrat@osadl.org> | 2015-05-11 10:38:02 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-05-11 17:14:37 -0400 |
commit | 94634e9861abbc3036d7041773971c8e31ec2680 (patch) | |
tree | 9e0d5929005dc891a91d762f85a9ab81a830e128 /drivers/infiniband | |
parent | b6b2bbe65b2117afd9766faa7cffea4d8f681455 (diff) |
IB/ehca: use correct destination for memcpy
Using an element of a struct as the address for the memcpy of the whole
struct may introduce a buffer overflow and does not help readability either
simply pass the real thing as first argument to memcpy.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_mcast.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_mcast.c b/drivers/infiniband/hw/ehca/ehca_mcast.c index 120aedf9f989..cec181532924 100644 --- a/drivers/infiniband/hw/ehca/ehca_mcast.c +++ b/drivers/infiniband/hw/ehca/ehca_mcast.c | |||
@@ -77,7 +77,7 @@ int ehca_attach_mcast(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
77 | return -EINVAL; | 77 | return -EINVAL; |
78 | } | 78 | } |
79 | 79 | ||
80 | memcpy(&my_gid.raw, gid->raw, sizeof(union ib_gid)); | 80 | memcpy(&my_gid, gid->raw, sizeof(union ib_gid)); |
81 | 81 | ||
82 | subnet_prefix = be64_to_cpu(my_gid.global.subnet_prefix); | 82 | subnet_prefix = be64_to_cpu(my_gid.global.subnet_prefix); |
83 | interface_id = be64_to_cpu(my_gid.global.interface_id); | 83 | interface_id = be64_to_cpu(my_gid.global.interface_id); |
@@ -114,7 +114,7 @@ int ehca_detach_mcast(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
114 | return -EINVAL; | 114 | return -EINVAL; |
115 | } | 115 | } |
116 | 116 | ||
117 | memcpy(&my_gid.raw, gid->raw, sizeof(union ib_gid)); | 117 | memcpy(&my_gid, gid->raw, sizeof(union ib_gid)); |
118 | 118 | ||
119 | subnet_prefix = be64_to_cpu(my_gid.global.subnet_prefix); | 119 | subnet_prefix = be64_to_cpu(my_gid.global.subnet_prefix); |
120 | interface_id = be64_to_cpu(my_gid.global.interface_id); | 120 | interface_id = be64_to_cpu(my_gid.global.interface_id); |