41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
commit 34ab92ebc818bc5b356f1d297868512225493eca
|
|
Author: Sathvika Vasireddy <sv@linux.ibm.com>
|
|
Date: Thu Nov 9 02:37:36 2023 +0530
|
|
|
|
libvpd: Prevent adding duplicate entries in addDeviceSpecific() function
|
|
|
|
Currently, addDeviceSpecific() adds new 'DataItem' to the
|
|
'mDeviceSpecific' vector without checking for duplicates. This
|
|
vector can be further used by the front end tools to list vpd
|
|
information. If this vector has duplicate entries, then vpd
|
|
information for a specific device is listed more than once.
|
|
|
|
To fix this, prevent duplicate entries with the same 'ac' value
|
|
from being stored in the vector. Check if a 'DataItem' with
|
|
the same ac value already exists in the vector, and add the new
|
|
object to the vector only if no matching item is found.
|
|
|
|
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
|
|
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
|
|
|
|
diff --git a/src/component.cpp b/src/component.cpp
|
|
index 44208ac..a945fc1 100644
|
|
--- a/src/component.cpp
|
|
+++ b/src/component.cpp
|
|
@@ -937,7 +937,6 @@ lderr:
|
|
d->ac = ac;
|
|
d->humanName = humanName;
|
|
d->setValue( val, lvl, __FILE__, __LINE__ );
|
|
-#if 0
|
|
|
|
/*
|
|
* There can be multiple records with the 'CL' key.
|
|
@@ -952,7 +951,6 @@ lderr:
|
|
if( (*i)->ac == ac )
|
|
return; //Failed to add - already present
|
|
}
|
|
-#endif
|
|
|
|
mDeviceSpecific.push_back( d );
|
|
}
|