Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
string.h: Introduce memset_startat() for wiping trailing members and …
…padding 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]>
- Loading branch information