Linux: Clear msghdr structure before use 09/15409/3
authorCheyenne Wills <cwills@sinenomine.net>
Thu, 27 Apr 2023 15:49:03 +0000 (09:49 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 28 Apr 2023 00:29:11 +0000 (20:29 -0400)
commit795ef90d4041f1a5a1139435cc70f96457e0f64b
tree03e3b6df3863fe082e20419e8d86c9ea8832291d
parent5a7630acfd8bfd462b633475a6e195d9dbdfb451
Linux: Clear msghdr structure before use

The msghdr structure is used as a parameter to the Linux kernel
functions kernel_sendmsg() and kernel_recvmsg(). Some required fields
need to be set prior to calling these functions, but there are also
additional structure members that may not be used by the calling code.
Some of these fields may be initialized by the Linux kernel functions
being used, but there may be some that are left uninitialized.

To ensure that all fields in the msghdr structure are cleared, use
memset to zero the entire structure. This will eliminate the need to set
individual fields to 0 or NULL.

Change-Id: I7cdc7539084d13efedbb20e7ebd5c242693a628c
Reviewed-on: https://gerrit.openafs.org/15409
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/rx/LINUX/rx_knet.c