Skip to content

Commit

Permalink
fix SA4006: this value of address is never used (staticcheck)
Browse files Browse the repository at this point in the history
Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Mar 30, 2024
1 parent 5121f36 commit af499f2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions user/config/config_gotls.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,15 @@ func (gc *GoTLSConfig) findPieSymbolAddr(lfunc string) (uint64, error) {
return 0, errors.New("Cant found symbol address on pie model.")
}
var err error
var address uint64
for _, prog := range gc.goElf.Progs {
if prog.Type != elf.PT_LOAD || (prog.Flags&elf.PF_X) == 0 {
continue
}
// For more info on this calculation: stackoverflow.com/a/40249502
address = f.Value
if prog.Vaddr <= f.Value && f.Value < (prog.Vaddr+prog.Memsz) {
funcLen := f.End - f.Entry
data := make([]byte, funcLen)
address = f.Value - prog.Vaddr + prog.Off + IdaProOffset
address := f.Value - prog.Vaddr + prog.Off + IdaProOffset
_, err = prog.ReadAt(data, int64(address))
if err != nil {
return 0, fmt.Errorf("search function return: %w", err)
Expand Down

0 comments on commit af499f2

Please sign in to comment.