Skip to content

Commit

Permalink
Fix implicit memory aliasing in loop
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Lezar <[email protected]>
  • Loading branch information
elezar committed Jan 28, 2024
1 parent b25e906 commit de81383
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmd/nvidia-mig-parted/assert/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ func WalkSelectedMigConfigForEachGPU(migConfig v1.MigConfigSpecSlice, f func(*v1

log.Debugf(" GPU %v: %v", i, deviceID)

err = f(&mc, i, deviceID)
migConfigSpec := mc
err = f(&migConfigSpec, i, deviceID)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/mig/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ func (m *migStateManager) RestoreConfig(state *types.MigState) error {
return fmt.Errorf("error getting GPU instance profile info for '%v': %v", giState.ProfileID, ret)
}

gi, ret := device.CreateGpuInstanceWithPlacement(&giProfileInfo, &giState.Placement)
placement := giState.Placement
gi, ret := device.CreateGpuInstanceWithPlacement(&giProfileInfo, &placement)
if ret.Value() != nvml.SUCCESS {
return fmt.Errorf("error creating GPU instance for '%v': %v", giState.ProfileID, ret)
}
Expand Down

0 comments on commit de81383

Please sign in to comment.