Thread (152 messages) 152 messages, 21 authors, 2021-08-13

Re: [PATCH 06/64] bnxt_en: Use struct_group_attr() for memcpy() region

From: Michael Chan <michael.chan@broadcom.com>
Date: 2021-07-28 01:03:38
Also in: dri-devel, linux-block, linux-hardening, linux-kbuild, linux-wireless, lkml, netdev

On Tue, Jul 27, 2021 at 2:01 PM Kees Cook [off-list ref] wrote:
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Use struct_group() around members queue_id, min_bw, max_bw, tsa, pri_lvl,
and bw_weight so they can be referenced together. This will allow memcpy()
and sizeof() to more easily reason about sizes, improve readability,
and avoid future warnings about writing beyond the end of queue_id.

"pahole" shows no size nor member offset changes to struct bnxt_cos2bw_cfg.
"objdump -d" shows no meaningful object code changes (i.e. only source
line number induced differences and optimizations).

Signed-off-by: Kees Cook <redacted>
Thanks.
Reviewed-by: Michael Chan <michael.chan@broadcom.com>

Attachments

  • smime.p7s [application/pkcs7-signature] 4209 bytes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help