projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b6b2bbe
)
IB/ehca: use correct destination for memcpy
author
Nicholas Mc Guire
<
[email protected]
>
Mon, 11 May 2015 14:38:02 +0000
(16:38 +0200)
committer
Doug Ledford
<
[email protected]
>
Mon, 11 May 2015 21:14:37 +0000
(17:14 -0400)
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 <
[email protected]
>
Signed-off-by: Nicholas Mc Guire <
[email protected]
>
Signed-off-by: Doug Ledford <
[email protected]
>
drivers/infiniband/hw/ehca/ehca_mcast.c
patch
|
blob
|
history
diff --git
a/drivers/infiniband/hw/ehca/ehca_mcast.c
b/drivers/infiniband/hw/ehca/ehca_mcast.c
index 120aedf9f989a7a34839046a360dd9ad53816d64..cec1815329245cfa6573f39ce3f44f628175fea7 100644
(file)
--- 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)
return -EINVAL;
}
- memcpy(&my_gid
.raw
, gid->raw, sizeof(union ib_gid));
+ memcpy(&my_gid, gid->raw, sizeof(union ib_gid));
subnet_prefix = be64_to_cpu(my_gid.global.subnet_prefix);
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)
return -EINVAL;
}
- memcpy(&my_gid
.raw
, gid->raw, sizeof(union ib_gid));
+ memcpy(&my_gid, gid->raw, sizeof(union ib_gid));
subnet_prefix = be64_to_cpu(my_gid.global.subnet_prefix);
interface_id = be64_to_cpu(my_gid.global.interface_id);