Skip to content

Commit

Permalink
pkg/uefi/meregion: fix type FTP->FPT
Browse files Browse the repository at this point in the history
Easily confused: FPTR is the name of one partition, whereas
FPT is the Firmware Partition Table (as far as we know).

Signed-off-by: Daniel Maslowski <[email protected]>
  • Loading branch information
orangecms committed Sep 28, 2024
1 parent d9260b5 commit 04853b4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/uefi/meregion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
//
// ME partition informations from http://me.bios.io/ME_blob_format

// MEFTPSignature is the sequence of bytes that an ME Flash Partition
// MEFPTSignature is the sequence of bytes that an ME Flash Partition
// Table is expected to start with ie "$FPT".
var (
MEFTPSignature = []byte{0x24, 0x46, 0x50, 0x54}
MEFPTSignature = []byte{0x24, 0x46, 0x50, 0x54}
)

const (
Expand Down Expand Up @@ -95,13 +95,13 @@ func (e MEPartitionEntry) Type() string {

// FindMEDescriptor searches for an Intel ME FTP signature
func FindMEDescriptor(buf []byte) (int, error) {
if bytes.Equal(buf[16:16+len(MEFTPSignature)], MEFTPSignature) {
if bytes.Equal(buf[16:16+len(MEFPTSignature)], MEFPTSignature) {
// 16 + 4 since the descriptor starts after the signature
return 16 + len(MEFTPSignature), nil
return 16 + len(MEFPTSignature), nil
}
if bytes.Equal(buf[:len(MEFTPSignature)], MEFTPSignature) {
if bytes.Equal(buf[:len(MEFPTSignature)], MEFPTSignature) {
// + 4 since the descriptor starts after the signature
return len(MEFTPSignature), nil
return len(MEFPTSignature), nil
}
return -1, fmt.Errorf("ME Flash Partition Table signature %#02x not found: first 20 bytes are:\n%s", MEFTPSignature, hex.Dump(buf[:20]))
}
Expand Down

0 comments on commit 04853b4

Please sign in to comment.