aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChaithanya Lagisetty <nagachaithanya9911@gmail.com>2026-09-01 07:06:18 +0000
committerDavid Heidelberg <david@ixit.cz>2026-09-23 22:13:16 +0200
commiteda518d2cdb6074a0bcdfa06af291616bcb5c421 (patch)
tree9011888c3484b9031ec3e1803107a7fe1826186d /tools
parentc3eef2f988a3db9690369d7cef9a3344dd9788d3 (diff)
selftests: nci: Fix uninitialized family ID on missing attribute
get_family_id() walks the generic netlink CTRL_CMD_GETFAMILY reply looking for the CTRL_ATTR_FAMILY_ID attribute and returns the parsed value in the local variable "id". If the reply does not carry that attribute, the parsing loop never assigns "id" and the function returns an indeterminate stack value, which the caller stores in self->fid and uses for subsequent netlink requests. Initialize "id" to 0 so a missing attribute yields a deterministic (invalid) family ID instead of a garbage value. Fixes: f595cf1242f3 ("selftests: Add nci suite") Signed-off-by: Chaithanya Lagisetty <nagachaithanya9911@gmail.com> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Link: https://patch.msgid.link/20260901070618.3299012-1-nagachaithanya9911@gmail.com Signed-off-by: David Heidelberg <david@ixit.cz>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/nci/nci_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c
index c053f5cf2745..23fd38acfcf4 100644
--- a/tools/testing/selftests/nci/nci_dev.c
+++ b/tools/testing/selftests/nci/nci_dev.c
@@ -182,7 +182,7 @@ static int get_family_id(int sd, __u32 pid, __u32 *event_group)
} ans;
struct nlattr *na;
int resp_len;
- __u16 id;
+ __u16 id = 0;
int len;
int rc;