Fix implicit memory aliasing in for loop

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-08-25 17:50:43 +02:00
parent 1b16b341dd
commit 709e27bf4b
11 changed files with 14 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ var _ oci.SpecModifier = (*fromCDISpec)(nil)
// Modify applies the mofiications defined by the raw CDI spec to the incomming OCI spec.
func (m fromCDISpec) Modify(spec *specs.Spec) error {
for _, device := range m.cdiSpec.Devices {
device := device
cdiDevice := cdi.Device{
Device: &device,
}