tools/capable: Set data to zero before setting fields.
This commit ensures data contains all 0 before setting its fields.
So, even if some fields are not set, there should be no problem with unaligned
access.
@@ -182,7 +182,15 @@ int kprobe__cap_capable(struct pt_regs *ctx, const struct cred *cred,
}
u32 uid = bpf_get_current_uid_gid();
- struct data_t data = {.tgid = tgid, .pid = pid, .uid = uid, .cap = cap, .audit = audit, .insetid = insetid};
+
+ struct data_t data = {};
+
+ data.tgid = tgid;
+ data.pid = pid;
+ data.uid = uid;
+ data.cap = cap;
+ data.audit = audit;
+ data.insetid = insetid;
#ifdef KERNEL_STACKS
data.kernel_stack_id = stacks.get_stackid(ctx, 0);
#endif
