mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 14:55:18 +00:00
lib, ovs-vsctl: Add zero-initializations.
This commit adds zero-initializations by changing `SFL_ALLOC` from `malloc` to `xzalloc`, adding a `memset` call to `sflAlloc`, initializing a `pollfd` struct variable with zeroes, and changing some calls to `xmalloc` to `xzalloc`. This is to prevent potential data leaks or undefined behavior from potentially uninitialized variables. Some variables would always be initialized by either the code flow or the compiler. Thus, some of the associated Coverity reports might be false positives. That said, it is still considered best practice to zero-initialize variables upfront just in case to ensure the overall resilience and security of OVS, as long as they do not impact performance-critical code. As a bonus, it would also make static analyzer tools, such as Coverity, happy. Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
1116459b3b
commit
40546cd6e5
@@ -337,7 +337,7 @@ void sfl_agent_sysError(SFLAgent *agent, char *modName, char *msg);
|
||||
|
||||
u_int32_t sfl_receiver_samplePacketsSent(SFLReceiver *receiver);
|
||||
|
||||
#define SFL_ALLOC malloc
|
||||
#define SFL_ALLOC xzalloc
|
||||
#define SFL_FREE free
|
||||
|
||||
#endif /* SFLOW_API_H */
|
||||
|
Reference in New Issue
Block a user