selftests/powerpc/papr-vpd: Fix missing variable initialization
authorNathan Lynch <nathanl@linux.ibm.com>
Thu, 4 Apr 2024 22:02:09 +0000 (17:02 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 12 Apr 2024 04:40:07 +0000 (14:40 +1000)
The "close handle without consuming VPD" testcase has inconsistent
results because it fails to initialize the location code object it
passes to ioctl() to create a VPD handle. Initialize the location code
to the empty string as intended.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Fixes: 9118c5d32bdd ("powerpc/selftests: Add test for papr-vpd")
Reported-by: Geetika Moolchandani <geetika@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240404-papr-vpd-test-uninit-lc-v2-1-37bff46c65a5@linux.ibm.com
tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c

index 505294da1b9fb5e7bd07aac4a119164900c8f2e6..d6f99eb9be659d3c9bb60b922e4f81102ac7f918 100644 (file)
@@ -154,7 +154,7 @@ static int dev_papr_vpd_null_handle(void)
 static int papr_vpd_close_handle_without_reading(void)
 {
        const int devfd = open(DEVPATH, O_RDONLY);
-       struct papr_location_code lc;
+       struct papr_location_code lc = { .str = "", };
        int fd;
 
        SKIP_IF_MSG(devfd < 0 && errno == ENOENT,