Handle ECC update
By default openpower-vpd-parser contains dummy code of ecc_create
which writes 0s to the vpd-ecc. And this corrupts the ECC.
This commit will not allow the user to update any record-kwd-data
with dummy ecc_create code as it returns -1. If want to update any vpd
data then build your image with vpdecc functions implementation.
Test-
when tried to update the keyword-
busctl call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager WriteKeyword ossay "/system/chassis/motherboard" "VINI" "PN" 1 65
ERROR: ECC update failed
And another terminal output-
root@rainier:/tmp# ./vpd-manager
Error: Couldn't update the ECC
Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
Change-Id: I7333a79ff06ac1acd21f9e10f99b4a78cb5705db
diff --git a/vpdecc/vpdecc.c b/vpdecc/vpdecc.c
index f7cf7eb..64e2f54 100644
--- a/vpdecc/vpdecc.c
+++ b/vpdecc/vpdecc.c
@@ -5,9 +5,7 @@
int vpdecc_create_ecc(const unsigned char* data, size_t data_length,
unsigned char* ecc, size_t* ecc_buffersize)
{
- int i, vRet = 0;
-
- memset(ecc, 0, *ecc_buffersize);
+ int i, vRet = -1;
return vRet;
}