Kees Cook 1c200f832e net: qed: Fix memcpy() overflow of qed_dcbx_params()
The source (&dcbx_info->operational.params) and dest
(&p_hwfn->p_dcbx_info->set.config.params) are both struct qed_dcbx_params
(560 bytes), not struct qed_dcbx_admin_params (564 bytes), which is used
as the memcpy() size.

However it seems that struct qed_dcbx_operational_params
(dcbx_info->operational)'s layout matches struct qed_dcbx_admin_params
(p_hwfn->p_dcbx_info->set.config)'s 4 byte difference (3 padding, 1 byte
for "valid").

On the assumption that the size is wrong (rather than the source structure
type), adjust the memcpy() size argument to be 4 bytes smaller and add
a BUILD_BUG_ON() to validate any changes to the structure sizes.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-17 12:14:51 -07:00
..
2021-05-15 08:32:51 -07:00
2021-05-05 13:24:11 -07:00
2021-05-16 10:13:14 -07:00
2021-04-18 09:36:56 +03:00
2021-05-15 08:52:30 -07:00
2021-04-26 12:11:52 -07:00
2021-05-20 06:31:52 -10:00
2021-04-28 15:59:13 -07:00
2021-05-20 14:46:26 -10:00
2021-04-26 12:11:52 -07:00
2021-05-20 20:15:43 -10:00
2021-04-27 18:09:44 -07:00
2021-05-20 06:31:52 -10:00
2021-05-01 10:14:08 -07:00
2021-05-05 13:24:11 -07:00
2021-05-13 14:53:49 -04:00
2021-04-28 15:59:13 -07:00
2021-05-20 06:40:20 -10:00
2021-05-01 10:14:08 -07:00
2021-04-29 11:57:23 -07:00
2021-05-05 12:53:16 -07:00
2021-04-28 15:59:13 -07:00
2021-05-04 11:13:33 -07:00
2021-05-05 13:24:11 -07:00
2021-05-03 12:15:21 -07:00
2021-05-07 11:35:12 -07:00
2021-05-20 14:41:35 -10:00
2021-05-01 09:33:00 -07:00
2021-05-08 10:44:36 -07:00
2021-05-17 16:06:02 +02:00
2021-05-20 06:31:52 -10:00
2021-05-16 10:13:14 -07:00
2021-05-01 09:33:00 -07:00
2021-05-05 13:31:39 -07:00
2021-05-20 06:31:52 -10:00
2021-04-28 15:59:13 -07:00
2021-05-05 13:31:39 -07:00