Age | Commit message (Collapse) | Author | Files | Lines |
|
A common idiom in kernel code is to wipe the contents of a structure
starting from a given member. These open-coded cases are usually difficult
to read and very sensitive to struct layout changes. Like memset_after(),
introduce a new helper, memset_startat() that takes the target struct
instance, the byte to write, and the member name where zeroing should
start.
Note that this doesn't zero padding preceding the target member. For
those cases, memset_after() should be used on the preceding member.
Cc: Steffen Klassert <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Francis Laniel <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Cc: Daniel Axtens <[email protected]>
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
|
|
A common idiom in kernel code is to wipe the contents of a structure
after a given member. This is especially useful in places where there is
trailing padding. These open-coded cases are usually difficult to read
and very sensitive to struct layout changes. Introduce a new helper,
memset_after() that takes the target struct instance, the byte to write,
and the member name after which the zeroing should start.
Cc: Steffen Klassert <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Francis Laniel <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Cc: Daniel Axtens <[email protected]>
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
|
|
Before changing anything about memcpy(), memmove(), and memset(), add
run-time tests to check basic behaviors for any regressions.
Signed-off-by: Kees Cook <[email protected]>
|